Version: 9.15.0
YACS::ENGINE::ArrayAny Class Reference

#include <Any.hxx>

Inheritance diagram for YACS::ENGINE::ArrayAny:
Collaboration diagram for YACS::ENGINE::ArrayAny:

Public Member Functions

void setEltAtRank (int i, const Any *elem)
 
bool operator== (const Any &other) const
 
AnyPtr operator[] (int i) const
 
unsigned int size () const
 
Anyclone () const
 
- Public Member Functions inherited from YACS::ENGINE::ComposedAny
AnyPtr operator[] (const char *key) const
 
- Public Member Functions inherited from YACS::ENGINE::Any
const TypeCodegetType () const
 
- Public Member Functions inherited from YACS::ENGINE::RefCounter
unsigned int getRefCnt () const
 
void incrRef () const
 
bool decrRef () const
 

Static Public Member Functions

template<class T >
static ArrayAnyNew (const std::vector< T > &vec)
 
template<class T >
static ArrayAnyNew (const T *val, unsigned int lgth)
 
static ArrayAnyNew (const TypeCode *typeOfContent, unsigned int lgth)
 

Protected Member Functions

void putMyReprAtPlace (char *data) const
 
- Protected Member Functions inherited from YACS::ENGINE::ComposedAny
 ComposedAny (const ComposedAny &other)
 
 ComposedAny (TypeCode *type, bool isNew=true)
 
void checkTypeOf (const Any *elem) const
 
- Protected Member Functions inherited from YACS::ENGINE::Any
virtual ~Any ()
 
 Any (TypeCode *type)
 
 Any (const Any &other)
 
- Protected Member Functions inherited from YACS::ENGINE::RefCounter
 RefCounter ()
 
 RefCounter (const RefCounter &other)
 
virtual ~RefCounter ()
 

Static Protected Member Functions

static void putReprAtPlace (char *data, const char *src, const TypeCodeArray *type, bool deepCpy)
 
static void destroyReprAtPlace (char *data, const TypeCodeArray *type)
 
static AnyPtr getOrBuildFromData (char *data, const TypeCodeArray *type)
 
static bool takeInChargeStorageOf (TypeCode *type)
 
- Static Protected Member Functions inherited from YACS::ENGINE::Any
static bool IsNull (char *data)
 

Protected Attributes

char * _data
 
- Protected Attributes inherited from YACS::ENGINE::Any
TypeCode_type
 
- Protected Attributes inherited from YACS::ENGINE::RefCounter
unsigned int _cnt
 

Private Member Functions

 ~ArrayAny ()
 
 ArrayAny (const TypeCode *typeOfContent, unsigned int lgth)
 
 ArrayAny (char *data, TypeCodeArray *type)
 
 ArrayAny (const ArrayAny &other)
 
 ArrayAny (const int *val, unsigned int lgth)
 
 ArrayAny (const bool *val, unsigned int lgth)
 
 ArrayAny (const double *val, unsigned int lgth)
 
 ArrayAny (const std::vector< int > &val)
 
 ArrayAny (const std::vector< double > &val)
 
 ArrayAny (const std::vector< std::string > &val)
 

Friends

class TypeCodeArray
 

Additional Inherited Members

- Static Public Attributes inherited from YACS::ENGINE::RefCounter
static unsigned int _totalCnt =0
 

Detailed Description

Definition at line 249 of file Any.hxx.

Constructor & Destructor Documentation

◆ ~ArrayAny()

ArrayAny::~ArrayAny ( )
private

Definition at line 890 of file Any.cxx.

891 {
892  const TypeCode *subType=_type->contentType();
893  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
894  unsigned int size=((TypeCodeArray *)_type)->getStaticLgth();
895  char *tmp=_data;
896  for(unsigned i=0;i<size;i++,tmp+=sizePerContent)
897  subType->destroyZippedAny(tmp);
898  delete [] _data;
899 }
TypeCode * _type
Definition: Any.hxx:106
unsigned int size() const
Definition: Any.cxx:1003
Class for array objects.
Definition: TypeCode.hxx:193
Base class for all type objects.
Definition: TypeCode.hxx:68
virtual void destroyZippedAny(char *data) const
Definition: TypeCode.cxx:62
virtual const TypeCode * contentType() const
Definition: TypeCode.cxx:174
virtual unsigned getSizeInByteOfAnyReprInSeq() const
Definition: TypeCode.cxx:157

References _data, YACS::ENGINE::Any::_type, YACS::ENGINE::TypeCode::contentType(), YACS::ENGINE::TypeCode::destroyZippedAny(), YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq(), yacsorb.CORBAEngineTest::i, and size().

◆ ArrayAny() [1/9]

ArrayAny::ArrayAny ( const TypeCode typeOfContent,
unsigned int  lgth 
)
private

Definition at line 901 of file Any.cxx.

901  :ComposedAny(new TypeCodeArray("","",typeOfContent,lgth))
902 {
904  for(unsigned int i=0;i<_type->getSizeInByteOfAnyReprInSeq();i++)
906 }
friend class TypeCodeArray
Definition: Any.hxx:251
ComposedAny(const ComposedAny &other)
Definition: Any.cxx:500
static const char DFT_CHAR_VAR
Definition: Any.hxx:181

References _data, YACS::ENGINE::Any::_type, YACS::ENGINE::SeqAlloc::DFT_CHAR_VAR, YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq(), and yacsorb.CORBAEngineTest::i.

◆ ArrayAny() [2/9]

ArrayAny::ArrayAny ( char *  data,
TypeCodeArray type 
)
private

Definition at line 908 of file Any.cxx.

908  :ComposedAny(type,false),_data(0)
909 {
911  const TypeCode *subType=_type->contentType();
912  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
913  for(unsigned i=0;i<type->getStaticLgth();i++)
914  subType->putReprAtPlace(_data+i*sizePerContent,data+i*sizePerContent,false);
915 }
unsigned getStaticLgth() const
Definition: TypeCode.cxx:576
virtual void putReprAtPlace(char *pt, const char *val, bool deepCpy) const
Definition: TypeCode.cxx:57

References _data, YACS::ENGINE::Any::_type, YACS::ENGINE::TypeCode::contentType(), YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq(), YACS::ENGINE::TypeCodeArray::getStaticLgth(), yacsorb.CORBAEngineTest::i, and YACS::ENGINE::TypeCode::putReprAtPlace().

◆ ArrayAny() [3/9]

ArrayAny::ArrayAny ( const ArrayAny other)
private

Definition at line 917 of file Any.cxx.

917  :ComposedAny(other)
918 {
920  const TypeCode *subType=_type->contentType();
921  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
922  for(unsigned i=0;i<((TypeCodeArray *)_type)->getStaticLgth();i++)
923  subType->putReprAtPlace(_data+i*sizePerContent,other._data+i*sizePerContent,true);
924 }

References _data, YACS::ENGINE::Any::_type, YACS::ENGINE::TypeCode::contentType(), YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq(), yacsorb.CORBAEngineTest::i, and YACS::ENGINE::TypeCode::putReprAtPlace().

◆ ArrayAny() [4/9]

ArrayAny::ArrayAny ( const int *  val,
unsigned int  lgth 
)
private

Definition at line 926 of file Any.cxx.

926  :ComposedAny(new TypeCodeArray("","",Runtime::_tc_int,lgth)),
927  _data(0)
928 {
930  memcpy(_data,val,_type->getSizeInByteOfAnyReprInSeq());
931 }
static YACS::ENGINE::TypeCode * _tc_int
Definition: Runtime.hxx:137

References _data, YACS::ENGINE::Any::_type, and YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq().

◆ ArrayAny() [5/9]

ArrayAny::ArrayAny ( const bool *  val,
unsigned int  lgth 
)
private

Definition at line 933 of file Any.cxx.

933  :ComposedAny(new TypeCodeArray("","",Runtime::_tc_bool,lgth)),
934  _data(0)
935 {
937  memcpy(_data,val,_type->getSizeInByteOfAnyReprInSeq());
938 }
static YACS::ENGINE::TypeCode * _tc_bool
Definition: Runtime.hxx:138

References _data, YACS::ENGINE::Any::_type, and YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq().

◆ ArrayAny() [6/9]

ArrayAny::ArrayAny ( const double *  val,
unsigned int  lgth 
)
private

Definition at line 940 of file Any.cxx.

941  _data(0)
942 {
944  memcpy(_data,val,_type->getSizeInByteOfAnyReprInSeq());
945 }
static YACS::ENGINE::TypeCode * _tc_double
Definition: Runtime.hxx:136

References _data, YACS::ENGINE::Any::_type, and YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq().

◆ ArrayAny() [7/9]

ArrayAny::ArrayAny ( const std::vector< int > &  val)
private

Definition at line 947 of file Any.cxx.

947  :ComposedAny(new TypeCodeArray("","",Runtime::_tc_int,val.size())),
948  _data(0)
949 {
951  memcpy(_data,&val[0],_type->getSizeInByteOfAnyReprInSeq());
952 }

References _data, YACS::ENGINE::Any::_type, and YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq().

◆ ArrayAny() [8/9]

ArrayAny::ArrayAny ( const std::vector< double > &  val)
private

Definition at line 954 of file Any.cxx.

954  :ComposedAny(new TypeCodeArray("","",Runtime::_tc_double,val.size())),
955  _data(0)
956 {
958  memcpy(_data,&val[0],_type->getSizeInByteOfAnyReprInSeq());
959 }

References _data, YACS::ENGINE::Any::_type, and YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq().

◆ ArrayAny() [9/9]

ArrayAny::ArrayAny ( const std::vector< std::string > &  val)
private

Definition at line 961 of file Any.cxx.

961  :ComposedAny(new TypeCodeArray("","",Runtime::_tc_string,val.size())),
962  _data(0)
963 {
965  unsigned i=0;
966  const TypeCode *subType=_type->contentType();
967  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
968  for(vector<std::string>::const_iterator iter=val.begin();iter!=val.end();iter++,i++)
969  {
970  StringOnHeap *st=new StringOnHeap(*iter);
971  memcpy(_data+i*sizePerContent,&st,sizePerContent);
972  }
973 }
static YACS::ENGINE::TypeCode * _tc_string
Definition: Runtime.hxx:139

References _data, YACS::ENGINE::Any::_type, YACS::ENGINE::TypeCode::contentType(), YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq(), and yacsorb.CORBAEngineTest::i.

Member Function Documentation

◆ clone()

Any * ArrayAny::clone ( ) const
virtual

Implements YACS::ENGINE::Any.

Definition at line 1008 of file Any.cxx.

1009 {
1010  return new ArrayAny(*this);
1011 }
friend class ArrayAny
Definition: Any.hxx:81

References YACS::ENGINE::Any::ArrayAny.

◆ destroyReprAtPlace()

void ArrayAny::destroyReprAtPlace ( char *  data,
const TypeCodeArray type 
)
staticprotected

Definition at line 1034 of file Any.cxx.

1035 {
1036  const TypeCode *subType=type->contentType();
1037  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
1038  for(unsigned i=0;i<type->getStaticLgth();i++)
1039  subType->destroyZippedAny(data+i*sizePerContent);
1040 }
virtual const TypeCode * contentType() const
Definition: TypeCode.cxx:581

References YACS::ENGINE::TypeCodeArray::contentType(), YACS::ENGINE::TypeCode::destroyZippedAny(), YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq(), YACS::ENGINE::TypeCodeArray::getStaticLgth(), and yacsorb.CORBAEngineTest::i.

Referenced by YACS::ENGINE::TypeCodeArray::destroyZippedAny().

◆ getOrBuildFromData()

AnyPtr ArrayAny::getOrBuildFromData ( char *  data,
const TypeCodeArray type 
)
staticprotected

Definition at line 1042 of file Any.cxx.

1043 {
1044  Any *ret;
1045  ret=new ArrayAny(data,(TypeCodeArray *)type);
1046  return AnyPtr(ret);
1047 }
: Interface for management of storage of data formated dynamically in its TypeCode....
Definition: Any.hxx:79
SharedPtr< Any > AnyPtr
Definition: Any.hxx:72

References YACS::ENGINE::Any::ArrayAny.

Referenced by YACS::ENGINE::TypeCodeArray::getOrBuildAnyFromZippedData().

◆ New() [1/3]

template<class T >
ArrayAny * YACS::ENGINE::ArrayAny::New ( const std::vector< T > &  vec)
static

Definition at line 324 of file Any.hxx.

325  {
326  return new ArrayAny(vec);
327  }

References YACS::ENGINE::Any::ArrayAny.

◆ New() [2/3]

template<class T >
ArrayAny * YACS::ENGINE::ArrayAny::New ( const T *  val,
unsigned int  lgth 
)
static

Definition at line 330 of file Any.hxx.

331  {
332  return new ArrayAny(val,lgth);
333  }

References YACS::ENGINE::Any::ArrayAny.

◆ New() [3/3]

ArrayAny * ArrayAny::New ( const TypeCode typeOfContent,
unsigned int  lgth 
)
static

Definition at line 1013 of file Any.cxx.

1014 {
1015  return new ArrayAny(typeOfContent,lgth);
1016 }

References YACS::ENGINE::Any::ArrayAny.

◆ operator==()

bool ArrayAny::operator== ( const Any other) const
virtual

Implements YACS::ENGINE::Any.

Definition at line 983 of file Any.cxx.

984 {
985  if(!_type->isA(other.getType()))
986  return false;
987  const ArrayAny& otherC=(const ArrayAny&) other;//cast granted due to previous lines
988  for(unsigned i=0;i<((const TypeCodeArray *)_type)->getStaticLgth();i++)
989  if(!((*(*this)[i])==(*otherC[i])))
990  return false;
991  return true;
992 }
const TypeCode * getType() const
Definition: Any.hxx:85
virtual int isA(const char *repositoryId) const
Definition: TypeCode.cxx:99

References YACS::ENGINE::Any::_type, YACS::ENGINE::Any::getType(), yacsorb.CORBAEngineTest::i, and YACS::ENGINE::TypeCode::isA().

◆ operator[]()

AnyPtr ArrayAny::operator[] ( int  i) const
virtual

Implements YACS::ENGINE::Any.

Definition at line 994 of file Any.cxx.

995 {
996  const TypeCode *subType=_type->contentType();
997  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
998  if(i<0 || i>=((TypeCodeArray *)_type)->getStaticLgth())
999  throw Exception("Trying to access to an invalid index in an Any Tuple");
1000  return _type->contentType()->getOrBuildAnyFromZippedData(_data+i*sizePerContent);
1001 }
virtual AnyPtr getOrBuildAnyFromZippedData(char *data) const
Definition: TypeCode.cxx:67

References _data, YACS::ENGINE::Any::_type, YACS::ENGINE::TypeCode::contentType(), YACS::ENGINE::TypeCode::getOrBuildAnyFromZippedData(), YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq(), and yacsorb.CORBAEngineTest::i.

◆ putMyReprAtPlace()

void ArrayAny::putMyReprAtPlace ( char *  data) const
protectedvirtual

Implements YACS::ENGINE::Any.

Definition at line 1018 of file Any.cxx.

1019 {
1020  const TypeCode *subType=_type->contentType();
1021  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
1022  for(unsigned i=0;i<((const TypeCodeArray *)_type)->getStaticLgth();i++)
1023  subType->putReprAtPlace(data+i*sizePerContent,_data+i*sizePerContent,false);
1024 }

References _data, YACS::ENGINE::Any::_type, YACS::ENGINE::TypeCode::contentType(), YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq(), yacsorb.CORBAEngineTest::i, and YACS::ENGINE::TypeCode::putReprAtPlace().

◆ putReprAtPlace()

void ArrayAny::putReprAtPlace ( char *  data,
const char *  src,
const TypeCodeArray type,
bool  deepCpy 
)
staticprotected

Definition at line 1026 of file Any.cxx.

1027 {
1028  const TypeCode *subType=type->contentType();
1029  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
1030  for(unsigned i=0;i<type->getStaticLgth();i++)
1031  subType->putReprAtPlace(data+i*sizePerContent,src+i*sizePerContent,deepCpy);
1032 }

References YACS::ENGINE::TypeCodeArray::contentType(), YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq(), YACS::ENGINE::TypeCodeArray::getStaticLgth(), yacsorb.CORBAEngineTest::i, and YACS::ENGINE::TypeCode::putReprAtPlace().

Referenced by YACS::ENGINE::TypeCodeArray::putReprAtPlace().

◆ setEltAtRank()

void ArrayAny::setEltAtRank ( int  i,
const Any elem 
)
virtual

◆ size()

unsigned int ArrayAny::size ( ) const

Definition at line 1003 of file Any.cxx.

1004 {
1005  return ((TypeCodeArray *)_type)->getStaticLgth();
1006 }

References YACS::ENGINE::Any::_type.

Referenced by ~ArrayAny().

◆ takeInChargeStorageOf()

bool ArrayAny::takeInChargeStorageOf ( TypeCode type)
staticprotected

Definition at line 1049 of file Any.cxx.

1050 {
1051  DynType typ=type->kind();
1052  return (typ==Array);
1053 }
DynType kind() const
Definition: TypeCode.cxx:47

References YACS::ENGINE::Array, and YACS::ENGINE::TypeCode::kind().

Friends And Related Function Documentation

◆ TypeCodeArray

friend class TypeCodeArray
friend

Definition at line 251 of file Any.hxx.

Member Data Documentation

◆ _data

char* YACS::ENGINE::ArrayAny::_data
protected

Definition at line 281 of file Any.hxx.

Referenced by ArrayAny(), operator[](), putMyReprAtPlace(), setEltAtRank(), and ~ArrayAny().


The documentation for this class was generated from the following files: