stl container and corba


I'm using corba to send types using stl container such as vector, pair,
map, etc. I think, it could ba good idea to use an helper to do the same
work as AnyConversion< std::vector<double> > for any types, using the
AnyConversion struct of the contained type (I give an example of such an
example at the end of this mail). To implement this conversion, the
actual AnyConversion specialization must provide a fonction to convert a
base type to a corba type without creating a temporary (I call them
toStdType and toCorbaType). I can provide a patch soon modifying the
base AnyConversion struct and adding an helper for std::vector.

I've seen there is an ongoing thread about TAO and typegen, where an
example is given by Peter with sequence of a struct. Is there any
developement in corba/transports yet ?

// helper convert any std::vector, given the conversion of type T
template<class T>
struct AnyConversion< std::vector<T> >
TAO::unbounded_value_sequence<AnyConversion<T>::CorbaType> CorbaType;
typedef std::vector<T> StdType;

static bool toStdType(StdType& dest, const CorbaType& src) {
dest.resize( src.length() );
for (size_t i = 0; i != t->length(); ++i) {
AnyConversion<T>::toStdType(dest[i], src[(CORBA::ULong)(i)]);

static bool toCorbaType(CorbaType& dest, const StdType&) {
dest.length( (CORBA::ULong)(orig.size()) );
for( size_t i = 0; i != src.size(); ++i)
AnyConversion<T>::toCorbaType(dest[(CORBA::ULong)(i)], src[i]);

static CorbaType* toAny(const StdType& orig) {
CorbaType* ret = new CorbaType();
toCorbaType(*ret, orig);
return ret;

static StdType get(const CorbaType* t) {
StdType ret;
toStdType(ret, *t);
return ret;

static bool update(const CORBA::Any& any, StdType& _value) {
CorbaType* result;
if ( any >>= result ) {
toStdType(_value, *result);
return true;
return false;

static CORBA::Any_ptr createAny( const StdType& t ) {
CORBA::Any_ptr ret = new CORBA::Any();
*ret <<= toAny( t );
return ret;

static bool updateAny( StdType const& t, CORBA::Any& any ) {
any <<= toAny( t );
return true;