void ClientHelperGenerator::structStart(const Poco::CppParser::Struct* pStruct, const CodeGenerator::Properties& properties) { AbstractGenerator::structStart(pStruct, properties); // add constructor/destructor Poco::CppParser::Function* pConstr = new Poco::CppParser::Function(_pStruct->name(), _pStruct); pConstr->setAccess(Poco::CppParser::Symbol::ACC_PUBLIC); pConstr->addDocumentation( " Creates a " + _pStruct->name() + "."); Poco::CppParser::Function* pDestr = new Poco::CppParser::Function(std::string("~")+_pStruct->name(), _pStruct); pDestr->setAccess(Poco::CppParser::Symbol::ACC_PUBLIC); pDestr->addDocumentation( " Destroys the " + _pStruct->name() + "."); // add a method TestProject::IMyClass::Ptr find(const std::string& uri) std::string iName (InterfaceGenerator::generateClassName(pStruct)); Poco::CppParser::Function* pFind = new Poco::CppParser::Function("static " + iName + "::Ptr find", _pStruct); pFind->makeInline(); pFind->addDocumentation(" Return an interface for the service object identified by the given URI."); pFind->addDocumentation(""); pFind->addDocumentation(" Depending on whether the service object has been registered on the same ORB, or not,"); pFind->addDocumentation(" the ORB will either return a RemoteObject (with forwards calls locally, without the"); pFind->addDocumentation(" need for serialization/deserialization), or a Proxy."); pFind->addDocumentation(""); pFind->addDocumentation(" The URI must have the following format: <scheme>://<authority>/<protocol>/<typeId>/<objectId>"); Poco::CppParser::Parameter* pParam1= new Poco::CppParser::Parameter("const std::string& uri", 0); pFind->addParameter(pParam1); pFind = new Poco::CppParser::Function(iName + "::Ptr findImpl", _pStruct); pFind->setAccess(Poco::CppParser::Symbol::ACC_PRIVATE); pParam1= new Poco::CppParser::Parameter("const std::string& uri", 0); pFind->addParameter(pParam1); pFind = new Poco::CppParser::Function("static " + iName + "::Ptr find", _pStruct); pFind->makeInline(); pFind->addDocumentation(" Return a Proxy for the service object identified by the given URI."); pFind->addDocumentation(""); pFind->addDocumentation(" The given protocol name is used to determine the Transport used by"); pFind->addDocumentation(" the Proxy. This is used for objects identified by URIs that do not"); pFind->addDocumentation(" follow the standard Remoting URI structure."); pParam1= new Poco::CppParser::Parameter("const std::string& uri", 0); Poco::CppParser::Parameter* pParam2= new Poco::CppParser::Parameter("const std::string& protocol", 0); pFind->addParameter(pParam1); pFind->addParameter(pParam2); pFind = new Poco::CppParser::Function(iName + "::Ptr findImpl", _pStruct); pFind->setAccess(Poco::CppParser::Symbol::ACC_PRIVATE); pParam1= new Poco::CppParser::Parameter("const std::string& uri", 0); pParam2= new Poco::CppParser::Parameter("const std::string& protocol", 0); pFind->addParameter(pParam1); pFind->addParameter(pParam2); _cppGen.addIncludeFile("Poco/RemotingNG/Identifiable.h"); _cppGen.addIncludeFile("Poco/RemotingNG/ORB.h"); Poco::CppParser::Variable* pVar = new Poco::CppParser::Variable("Poco::RemotingNG::ORB* _pORB", _pStruct); pVar->setAccess(Poco::CppParser::Symbol::ACC_PRIVATE); // the src file will need most includes: for generated RemoteObject+ ProxyFactory, + "Net/DNS.h" std::string proxyFactName = ProxyFactoryGenerator::generateQualifiedClassName(nameSpace(), pStruct); std::string iFullName (InterfaceGenerator::generateQualifiedClassName(nameSpace(), pStruct)); Poco::CppParser::NameSpace* pRoot = Poco::CppParser::NameSpace::root(); const Poco::CppParser::Struct* pPF = dynamic_cast <const Poco::CppParser::Struct*>(pRoot->lookup(proxyFactName)); const Poco::CppParser::Struct* pI = dynamic_cast <const Poco::CppParser::Struct*>(pRoot->lookup(iFullName)); poco_check_ptr (pPF); poco_check_ptr (pI); Poco::CodeGeneration::Utility::handleInclude(pI, _cppGen); Poco::CodeGeneration::Utility::handleSrcInclude(pPF, _cppGen); _cppGen.addSrcIncludeFile("Poco/SingletonHolder.h"); // add a method static ClassNameHelper& instance(); Poco::CppParser::Function* pInstance = new Poco::CppParser::Function("static "+_pStruct->name()+"& instance", _pStruct); pInstance->setAccess(Poco::CppParser::Symbol::ACC_PRIVATE); }