Information
We are currently investigating an issue with the editor of some pages. Please save your work and avoid to create new pages until this banner is gone.
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#ifndef _ASYNC_IDL_ #define _ASYNC_IDL_ #pragma prefix "alma" #include <acscommon.idl> #include <acscomponent.idl> module workshop { interface Async : ACS::ACSComponent { oneway void delayResult(in ACS::uLong delay, in ACS::CBuLong cb, in ACS::CBDescIn desc); }; }; #endif |
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#ifndef _ASYNC_IMPL_H #define _ASYNC_IMPL_H #include <acscomponentImpl.h> #include <AsyncS.h> class AsyncImpl : public virtual acscomponent::ACSComponentImpl, public virtual POA_workshop::Async { public: AsyncImpl(const ACE_CString& name, maci::ContainerServices* containerServices); virtual ~AsyncImpl(); void delayResult(ACS::uLong delay, ACS::CBuLong cb, ACS::CBDescIn desc); }; #endif ACS::Time timestamp; completion = ACSErrTypeOK::ACSErrOKCompletion(); completion = ACSErrTypeCommon::CouldntPerformActionCompletion(error_p, __FILE__, __LINE__, "::Door::closeAction");; #endif |
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#include <AsyncImpl.h> AsyncImpl::AsyncImpl(const ACE_CString& name, maci::ContainerServices* containerServices) : acscomponent::ACSComponentImpl(name, containerServices) { } AsyncImpl::~AsyncImpl() { } void AsyncImpl::delayResult(ACS::uLong delay, ACS::CBuLong cb, ACS::CBDescIn desc) { ACSErr::Completion completion; ACS::CBDescOut descOut; completion = ACSErrTypeOK::ACSErrOKCompletion() cb->working(0, completion, descOut); sleep(delay); cb->done(delay, completion, descOut); } /* --------------- [ MACI DLL support functions ] -----------------*/ #include <maciACSComponentDefines.h> MACI_DLL_SUPPORT_FUNCTIONS(AsyncImpl) /* ----------------------------------------------------------------*/ |
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#include <maciSimpleClient.h> #include <AsyncC.h> #include <ACSErrTypeCommon.h> #include <acsutilTimeStamp.h> using namespace maci; class CBuLongImpl : public virtual POA_ACS::CBuLong { public: CBuLongImpl() {value = 0; status=std::string("INIT");} virtual ~MyCBdouble~CBuLongImpl() {} void working (CORBAACS::uLong value, const ACSErr::Completion &c, const ACS::CBDescOut &desc) { status = std::string("WORKING"); this.value->value = value; } void done (CORBAACS::uLong value, const ACSErr::Completion &c, const ACS::CBDescOut &desc){ status = std::string("DONE"); this.value->value = value; } CORBA::Boolean negotiate (ACS::TimeInterval time_to_transmit, const ACS::CBDescOut &desc) { return true; } public: CORBA ACS::uLong value; public std::string status; }; int main(int argc, char *argv[]) { SimpleClient client; workshop::Async_var comp; if (client.init(argc,argv) == 0) { return -1; } else { client.login(); } try { comp = client.getComponent<workshop::Async>("ASYNC", 0, true); } catch(maciErrType::CannotGetComponentExImpl& _ex) { _ex.log(); return -1; } CBuLongImpl cb(){}; ACS::CBuLong_var cbObj = cb._this(); ACS::CBDescIn desc; desc.id_tag = 2; ACS_SHORT_LOG((LM_INFO, "%s", cb.status)); comp.delayResult->delayResult(8, cbObj.in(), desc); ACS_SHORT_LOG((LM_INFO, "%s", cb.status)); Thread.sleep(50005); ACS_SHORT_LOG((LM_INFO, "%s", cb.status)); Thread.sleep(50005); ACS_SHORT_LOG((LM_INFO, "%s", cb.status)); ACS_SHORT_LOG((LM_INFO, "%ul", cb.value)); try { client.releaseComponent("ASYNC"); } catch(maciErrType::CannotReleaseComponentExImpl &_ex) { _ex.log(); return -1; } client.logout(); ACE_OS::sleep(3); return 0; } |
...