[omniORB] String sequence

Michael omniorb at bindone.de
Thu Aug 14 22:38:28 BST 2008


No guru questions, trivial. Until you get the book, you can download the
c++ mapping spec for free from www.omg.org.

class MyClass_impl: virtual public POA_MyModule::MyClass
{
public:
  MyModule::MyClass::SeqStr* listContents(const char* locator)
  {
    std::cout << "Locator is " << locator << std::endl;
    std::auto_ptr<MyModule::MyClass::SeqStr> ret(new
MyModule::MyClass::SeqStr);

    ret->length(5);
    (*ret)[0] = "Please";
    (*ret)[1] = "buy";
    (*ret)[2] = "a book";
    (*ret)[3] = "about";
    (*ret)[4] = "CORBA!";
    return ret.release();
  }
};

As we discussd on this list before, you can also use the CORBA inbuild
memory management instead of auto_ptr (which would be
MyModule::MyClass::SeqStr_var). Using std::auto_ptr is just my personal
preference.

cheers
michael



Hamilton Temple wrote:
> Martin, thank you for your answer.
> 
> I know that CORBA cannot deal with pointers. Sorry, it was my way to express
> what
> I want. As you pointed, my intention is to return a sequence of strings.
> 
> I have been only able to find incomplete examples describing the process of
> mapping
> a sequence of string to C++. Silly me, I thought that doing this was much
> more
> straightforward. This kind of return type must be quite frequent in CORBA.
> 
> I will try to obtain a copy of the books you recommend me.
> 
> Just in case, any CORBA guru over there has done this before? :)
> Could you provide me detailed source code?
> 
> Thank you,
> 
> Hamilton
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list




More information about the omniORB-list mailing list