00001 #ifndef QPID_AMQP_0_10_PROXYTEMPLATE_H
00002 #define QPID_AMQP_0_10_PROXYTEMPLATE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00028
00029
00030 #include "qpid/amqp_0_10/specification.h"
00031
00032 namespace qpid {
00033 namespace amqp_0_10 {
00034
00035 template <class F, class R=typename F::result_type>
00036 class ProxyTemplate
00037 {
00038 public:
00039 ProxyTemplate(F f=F()) : functor(f) {}
00040
00041
00042 R connectionStart(
00043 const Map& serverProperties_,
00044 const Str16Array& mechanisms_,
00045 const Str16Array& locales_
00046 )
00047 {
00048 connection::Start start(serverProperties_, mechanisms_, locales_);
00049 return functor(start);
00050 }
00051
00052
00053 R connectionStartOk(
00054 const Map& clientProperties_,
00055 const Str8& mechanism_,
00056 const Vbin32& response_,
00057 const Str8& locale_
00058 )
00059 {
00060 connection::StartOk startOk(clientProperties_, mechanism_, response_, locale_);
00061 return functor(startOk);
00062 }
00063
00064
00065 R connectionSecure(const Vbin32& challenge_)
00066 {
00067 connection::Secure secure(challenge_);
00068 return functor(secure);
00069 }
00070
00071
00072 R connectionSecureOk(const Vbin32& response_)
00073 {
00074 connection::SecureOk secureOk(response_);
00075 return functor(secureOk);
00076 }
00077
00078
00079 R connectionTune(
00080 Uint16 channelMax_,
00081 Uint16 maxFrameSize_,
00082 Uint16 heartbeatMin_,
00083 Uint16 heartbeatMax_
00084 )
00085 {
00086 connection::Tune tune(channelMax_, maxFrameSize_, heartbeatMin_, heartbeatMax_);
00087 return functor(tune);
00088 }
00089
00090
00091 R connectionTuneOk(
00092 Uint16 channelMax_,
00093 Uint16 maxFrameSize_,
00094 Uint16 heartbeat_
00095 )
00096 {
00097 connection::TuneOk tuneOk(channelMax_, maxFrameSize_, heartbeat_);
00098 return functor(tuneOk);
00099 }
00100
00101
00102 R connectionOpen(
00103 const Str8& virtualHost_,
00104 const Str16Array& capabilities_,
00105 Bit insist_
00106 )
00107 {
00108 connection::Open open(virtualHost_, capabilities_, insist_);
00109 return functor(open);
00110 }
00111
00112
00113 R connectionOpenOk(const connection::AmqpHostArray& knownHosts_)
00114 {
00115 connection::OpenOk openOk(knownHosts_);
00116 return functor(openOk);
00117 }
00118
00119
00120 R connectionRedirect(
00121 const connection::AmqpHostUrl& host_,
00122 const connection::AmqpHostArray& knownHosts_
00123 )
00124 {
00125 connection::Redirect redirect(host_, knownHosts_);
00126 return functor(redirect);
00127 }
00128
00129
00130 R connectionHeartbeat()
00131 {
00132 connection::Heartbeat heartbeat;
00133 return functor(heartbeat);
00134 }
00135
00136
00137 R connectionClose(
00138 const connection::CloseCode& replyCode_,
00139 const Str8& replyText_
00140 )
00141 {
00142 connection::Close close(replyCode_, replyText_);
00143 return functor(close);
00144 }
00145
00146
00147 R connectionCloseOk()
00148 {
00149 connection::CloseOk closeOk;
00150 return functor(closeOk);
00151 }
00152
00153
00154 R sessionAttach(
00155 const session::Name& name_,
00156 Bit force_
00157 )
00158 {
00159 session::Attach attach(name_, force_);
00160 return functor(attach);
00161 }
00162
00163
00164 R sessionAttached(const session::Name& name_)
00165 {
00166 session::Attached attached(name_);
00167 return functor(attached);
00168 }
00169
00170
00171 R sessionDetach(const session::Name& name_)
00172 {
00173 session::Detach detach(name_);
00174 return functor(detach);
00175 }
00176
00177
00178 R sessionDetached(
00179 const session::Name& name_,
00180 const session::DetachCode& code_
00181 )
00182 {
00183 session::Detached detached(name_, code_);
00184 return functor(detached);
00185 }
00186
00187
00188 R sessionRequestTimeout(Uint32 timeout_)
00189 {
00190 session::RequestTimeout requestTimeout(timeout_);
00191 return functor(requestTimeout);
00192 }
00193
00194
00195 R sessionTimeout(Uint32 timeout_)
00196 {
00197 session::Timeout timeout(timeout_);
00198 return functor(timeout);
00199 }
00200
00201
00202 R sessionCommandPoint(
00203 const SequenceNo& commandId_,
00204 Uint64 commandOffset_
00205 )
00206 {
00207 session::CommandPoint commandPoint(commandId_, commandOffset_);
00208 return functor(commandPoint);
00209 }
00210
00211
00212 R sessionExpected(
00213 const session::Commands& commands_,
00214 const session::CommandFragments& fragments_
00215 )
00216 {
00217 session::Expected expected(commands_, fragments_);
00218 return functor(expected);
00219 }
00220
00221
00222 R sessionConfirmed(
00223 const session::Commands& commands_,
00224 const session::CommandFragments& fragments_
00225 )
00226 {
00227 session::Confirmed confirmed(commands_, fragments_);
00228 return functor(confirmed);
00229 }
00230
00231
00232 R sessionCompleted(
00233 const session::Commands& commands_,
00234 Bit timelyReply_
00235 )
00236 {
00237 session::Completed completed(commands_, timelyReply_);
00238 return functor(completed);
00239 }
00240
00241
00242 R sessionKnownCompleted(const session::Commands& commands_)
00243 {
00244 session::KnownCompleted knownCompleted(commands_);
00245 return functor(knownCompleted);
00246 }
00247
00248
00249 R sessionFlush(
00250 Bit expected_,
00251 Bit confirmed_,
00252 Bit completed_
00253 )
00254 {
00255 session::Flush flush(expected_, confirmed_, completed_);
00256 return functor(flush);
00257 }
00258
00259
00260 R sessionGap(const session::Commands& commands_)
00261 {
00262 session::Gap gap(commands_);
00263 return functor(gap);
00264 }
00265
00266
00267 R executionSync()
00268 {
00269 execution::Sync sync;
00270 return functor(sync);
00271 }
00272
00273
00274 R executionResult(
00275 const SequenceNo& commandId_,
00276 const Struct32& value_
00277 )
00278 {
00279 execution::Result result(commandId_, value_);
00280 return functor(result);
00281 }
00282
00283
00284 R executionException(
00285 const execution::ErrorCode& errorCode_,
00286 const SequenceNo& commandId_,
00287 Uint8 classCode_,
00288 Uint8 commandCode_,
00289 Uint8 fieldIndex_,
00290 const Str16& description_,
00291 const Map& errorInfo_
00292 )
00293 {
00294 execution::Exception exception(errorCode_, commandId_, classCode_, commandCode_, fieldIndex_, description_, errorInfo_);
00295 return functor(exception);
00296 }
00297
00298
00299 R messageTransfer(
00300 const message::Destination& destination_,
00301 const message::AcceptMode& acceptMode_,
00302 const message::AcquireMode& acquireMode_
00303 )
00304 {
00305 message::Transfer transfer(destination_, acceptMode_, acquireMode_);
00306 return functor(transfer);
00307 }
00308
00309
00310 R messageAccept(const session::Commands& transfers_)
00311 {
00312 message::Accept accept(transfers_);
00313 return functor(accept);
00314 }
00315
00316
00317 R messageReject(
00318 const session::Commands& transfers_,
00319 const message::RejectCode& code_,
00320 const Str8& text_
00321 )
00322 {
00323 message::Reject reject(transfers_, code_, text_);
00324 return functor(reject);
00325 }
00326
00327
00328 R messageRelease(
00329 const session::Commands& transfers_,
00330 Bit setRedelivered_
00331 )
00332 {
00333 message::Release release(transfers_, setRedelivered_);
00334 return functor(release);
00335 }
00336
00337
00338 R messageAcquire(const session::Commands& transfers_)
00339 {
00340 message::Acquire acquire(transfers_);
00341 return functor(acquire);
00342 }
00343
00344
00345 R messageResume(
00346 const message::Destination& destination_,
00347 const message::ResumeId& resumeId_
00348 )
00349 {
00350 message::Resume resume(destination_, resumeId_);
00351 return functor(resume);
00352 }
00353
00354
00355 R messageSubscribe(
00356 const queue::Name& queue_,
00357 const message::Destination& destination_,
00358 const message::AcceptMode& acceptMode_,
00359 const message::AcquireMode& acquireMode_,
00360 Bit exclusive_,
00361 const message::ResumeId& resumeId_,
00362 Uint64 resumeTtl_,
00363 const Map& arguments_
00364 )
00365 {
00366 message::Subscribe subscribe(queue_, destination_, acceptMode_, acquireMode_, exclusive_, resumeId_, resumeTtl_, arguments_);
00367 return functor(subscribe);
00368 }
00369
00370
00371 R messageCancel(const message::Destination& destination_)
00372 {
00373 message::Cancel cancel(destination_);
00374 return functor(cancel);
00375 }
00376
00377
00378 R messageSetFlowMode(
00379 const message::Destination& destination_,
00380 const message::FlowMode& flowMode_
00381 )
00382 {
00383 message::SetFlowMode setFlowMode(destination_, flowMode_);
00384 return functor(setFlowMode);
00385 }
00386
00387
00388 R messageFlow(
00389 const message::Destination& destination_,
00390 const message::CreditUnit& unit_,
00391 Uint32 value_
00392 )
00393 {
00394 message::Flow flow(destination_, unit_, value_);
00395 return functor(flow);
00396 }
00397
00398
00399 R messageFlush(const message::Destination& destination_)
00400 {
00401 message::Flush flush(destination_);
00402 return functor(flush);
00403 }
00404
00405
00406 R messageStop(const message::Destination& destination_)
00407 {
00408 message::Stop stop(destination_);
00409 return functor(stop);
00410 }
00411
00412
00413 R txSelect()
00414 {
00415 tx::Select select;
00416 return functor(select);
00417 }
00418
00419
00420 R txCommit()
00421 {
00422 tx::Commit commit;
00423 return functor(commit);
00424 }
00425
00426
00427 R txRollback()
00428 {
00429 tx::Rollback rollback;
00430 return functor(rollback);
00431 }
00432
00433
00434 R dtxSelect()
00435 {
00436 dtx::Select select;
00437 return functor(select);
00438 }
00439
00440
00441 R dtxStart(
00442 const dtx::Xid& xid_,
00443 Bit join_,
00444 Bit resume_
00445 )
00446 {
00447 dtx::Start start(xid_, join_, resume_);
00448 return functor(start);
00449 }
00450
00451
00452 R dtxEnd(
00453 const dtx::Xid& xid_,
00454 Bit fail_,
00455 Bit suspend_
00456 )
00457 {
00458 dtx::End end(xid_, fail_, suspend_);
00459 return functor(end);
00460 }
00461
00462
00463 R dtxCommit(
00464 const dtx::Xid& xid_,
00465 Bit onePhase_
00466 )
00467 {
00468 dtx::Commit commit(xid_, onePhase_);
00469 return functor(commit);
00470 }
00471
00472
00473 R dtxForget(const dtx::Xid& xid_)
00474 {
00475 dtx::Forget forget(xid_);
00476 return functor(forget);
00477 }
00478
00479
00480 R dtxGetTimeout(const dtx::Xid& xid_)
00481 {
00482 dtx::GetTimeout getTimeout(xid_);
00483 return functor(getTimeout);
00484 }
00485
00486
00487 R dtxPrepare(const dtx::Xid& xid_)
00488 {
00489 dtx::Prepare prepare(xid_);
00490 return functor(prepare);
00491 }
00492
00493
00494 R dtxRecover()
00495 {
00496 dtx::Recover recover;
00497 return functor(recover);
00498 }
00499
00500
00501 R dtxRollback(const dtx::Xid& xid_)
00502 {
00503 dtx::Rollback rollback(xid_);
00504 return functor(rollback);
00505 }
00506
00507
00508 R dtxSetTimeout(
00509 const dtx::Xid& xid_,
00510 Uint32 timeout_
00511 )
00512 {
00513 dtx::SetTimeout setTimeout(xid_, timeout_);
00514 return functor(setTimeout);
00515 }
00516
00517
00518 R exchangeDeclare(
00519 const exchange::Name& exchange_,
00520 const Str8& type_,
00521 const exchange::Name& alternateExchange_,
00522 Bit passive_,
00523 Bit durable_,
00524 Bit autoDelete_,
00525 const Map& arguments_
00526 )
00527 {
00528 exchange::Declare declare(exchange_, type_, alternateExchange_, passive_, durable_, autoDelete_, arguments_);
00529 return functor(declare);
00530 }
00531
00532
00533 R exchangeDelete(
00534 const exchange::Name& exchange_,
00535 Bit ifUnused_
00536 )
00537 {
00538 exchange::Delete delete_(exchange_, ifUnused_);
00539 return functor(delete_);
00540 }
00541
00542
00543 R exchangeQuery(const Str8& name_)
00544 {
00545 exchange::Query query(name_);
00546 return functor(query);
00547 }
00548
00549
00550 R exchangeBind(
00551 const queue::Name& queue_,
00552 const exchange::Name& exchange_,
00553 const Str8& bindingKey_,
00554 const Map& arguments_
00555 )
00556 {
00557 exchange::Bind bind(queue_, exchange_, bindingKey_, arguments_);
00558 return functor(bind);
00559 }
00560
00561
00562 R exchangeUnbind(
00563 const queue::Name& queue_,
00564 const exchange::Name& exchange_,
00565 const Str8& bindingKey_
00566 )
00567 {
00568 exchange::Unbind unbind(queue_, exchange_, bindingKey_);
00569 return functor(unbind);
00570 }
00571
00572
00573 R exchangeBound(
00574 const Str8& exchange_,
00575 const Str8& queue_,
00576 const Str8& bindingKey_,
00577 const Map& arguments_
00578 )
00579 {
00580 exchange::Bound bound(exchange_, queue_, bindingKey_, arguments_);
00581 return functor(bound);
00582 }
00583
00584
00585 R queueDeclare(
00586 const queue::Name& queue_,
00587 const exchange::Name& alternateExchange_,
00588 Bit passive_,
00589 Bit durable_,
00590 Bit exclusive_,
00591 Bit autoDelete_,
00592 const Map& arguments_
00593 )
00594 {
00595 queue::Declare declare(queue_, alternateExchange_, passive_, durable_, exclusive_, autoDelete_, arguments_);
00596 return functor(declare);
00597 }
00598
00599
00600 R queueDelete(
00601 const queue::Name& queue_,
00602 Bit ifUnused_,
00603 Bit ifEmpty_
00604 )
00605 {
00606 queue::Delete delete_(queue_, ifUnused_, ifEmpty_);
00607 return functor(delete_);
00608 }
00609
00610
00611 R queuePurge(const queue::Name& queue_)
00612 {
00613 queue::Purge purge(queue_);
00614 return functor(purge);
00615 }
00616
00617
00618 R queueQuery(const queue::Name& queue_)
00619 {
00620 queue::Query query(queue_);
00621 return functor(query);
00622 }
00623
00624
00625 R fileQos(
00626 Uint32 prefetchSize_,
00627 Uint16 prefetchCount_,
00628 Bit global_
00629 )
00630 {
00631 file::Qos qos(prefetchSize_, prefetchCount_, global_);
00632 return functor(qos);
00633 }
00634
00635
00636 R fileQosOk()
00637 {
00638 file::QosOk qosOk;
00639 return functor(qosOk);
00640 }
00641
00642
00643 R fileConsume(
00644 const queue::Name& queue_,
00645 const Str8& consumerTag_,
00646 Bit noLocal_,
00647 Bit noAck_,
00648 Bit exclusive_,
00649 Bit nowait_,
00650 const Map& arguments_
00651 )
00652 {
00653 file::Consume consume(queue_, consumerTag_, noLocal_, noAck_, exclusive_, nowait_, arguments_);
00654 return functor(consume);
00655 }
00656
00657
00658 R fileConsumeOk(const Str8& consumerTag_)
00659 {
00660 file::ConsumeOk consumeOk(consumerTag_);
00661 return functor(consumeOk);
00662 }
00663
00664
00665 R fileCancel(const Str8& consumerTag_)
00666 {
00667 file::Cancel cancel(consumerTag_);
00668 return functor(cancel);
00669 }
00670
00671
00672 R fileOpen(
00673 const Str8& identifier_,
00674 Uint64 contentSize_
00675 )
00676 {
00677 file::Open open(identifier_, contentSize_);
00678 return functor(open);
00679 }
00680
00681
00682 R fileOpenOk(Uint64 stagedSize_)
00683 {
00684 file::OpenOk openOk(stagedSize_);
00685 return functor(openOk);
00686 }
00687
00688
00689 R fileStage()
00690 {
00691 file::Stage stage;
00692 return functor(stage);
00693 }
00694
00695
00696 R filePublish(
00697 const exchange::Name& exchange_,
00698 const Str8& routingKey_,
00699 Bit mandatory_,
00700 Bit immediate_,
00701 const Str8& identifier_
00702 )
00703 {
00704 file::Publish publish(exchange_, routingKey_, mandatory_, immediate_, identifier_);
00705 return functor(publish);
00706 }
00707
00708
00709 R fileReturn(
00710 const file::ReturnCode& replyCode_,
00711 const Str8& replyText_,
00712 const exchange::Name& exchange_,
00713 const Str8& routingKey_
00714 )
00715 {
00716 file::Return return_(replyCode_, replyText_, exchange_, routingKey_);
00717 return functor(return_);
00718 }
00719
00720
00721 R fileDeliver(
00722 const Str8& consumerTag_,
00723 Uint64 deliveryTag_,
00724 Bit redelivered_,
00725 const exchange::Name& exchange_,
00726 const Str8& routingKey_,
00727 const Str8& identifier_
00728 )
00729 {
00730 file::Deliver deliver(consumerTag_, deliveryTag_, redelivered_, exchange_, routingKey_, identifier_);
00731 return functor(deliver);
00732 }
00733
00734
00735 R fileAck(
00736 Uint64 deliveryTag_,
00737 Bit multiple_
00738 )
00739 {
00740 file::Ack ack(deliveryTag_, multiple_);
00741 return functor(ack);
00742 }
00743
00744
00745 R fileReject(
00746 Uint64 deliveryTag_,
00747 Bit requeue_
00748 )
00749 {
00750 file::Reject reject(deliveryTag_, requeue_);
00751 return functor(reject);
00752 }
00753
00754
00755 R streamQos(
00756 Uint32 prefetchSize_,
00757 Uint16 prefetchCount_,
00758 Uint32 consumeRate_,
00759 Bit global_
00760 )
00761 {
00762 stream::Qos qos(prefetchSize_, prefetchCount_, consumeRate_, global_);
00763 return functor(qos);
00764 }
00765
00766
00767 R streamQosOk()
00768 {
00769 stream::QosOk qosOk;
00770 return functor(qosOk);
00771 }
00772
00773
00774 R streamConsume(
00775 const queue::Name& queue_,
00776 const Str8& consumerTag_,
00777 Bit noLocal_,
00778 Bit exclusive_,
00779 Bit nowait_,
00780 const Map& arguments_
00781 )
00782 {
00783 stream::Consume consume(queue_, consumerTag_, noLocal_, exclusive_, nowait_, arguments_);
00784 return functor(consume);
00785 }
00786
00787
00788 R streamConsumeOk(const Str8& consumerTag_)
00789 {
00790 stream::ConsumeOk consumeOk(consumerTag_);
00791 return functor(consumeOk);
00792 }
00793
00794
00795 R streamCancel(const Str8& consumerTag_)
00796 {
00797 stream::Cancel cancel(consumerTag_);
00798 return functor(cancel);
00799 }
00800
00801
00802 R streamPublish(
00803 const exchange::Name& exchange_,
00804 const Str8& routingKey_,
00805 Bit mandatory_,
00806 Bit immediate_
00807 )
00808 {
00809 stream::Publish publish(exchange_, routingKey_, mandatory_, immediate_);
00810 return functor(publish);
00811 }
00812
00813
00814 R streamReturn(
00815 const stream::ReturnCode& replyCode_,
00816 const Str8& replyText_,
00817 const exchange::Name& exchange_,
00818 const Str8& routingKey_
00819 )
00820 {
00821 stream::Return return_(replyCode_, replyText_, exchange_, routingKey_);
00822 return functor(return_);
00823 }
00824
00825
00826 R streamDeliver(
00827 const Str8& consumerTag_,
00828 Uint64 deliveryTag_,
00829 const exchange::Name& exchange_,
00830 const queue::Name& queue_
00831 )
00832 {
00833 stream::Deliver deliver(consumerTag_, deliveryTag_, exchange_, queue_);
00834 return functor(deliver);
00835 }
00836 private:
00837 F functor;
00838 };
00839
00840 }}
00841
00842 #endif