31 const char *
TypeCode::KIND_STR_REPR []={
"None",
"double",
"int",
"string",
"bool",
"Objref",
"Sequence",
"Array",
"Struct" };
101 throw Exception(
"Not implemented for this type");
122 if (tc->
kind() ==
Int)
return 1;
125 if (tc->
kind() ==
Int)
return 1;
132 if (tc->
kind() ==
Int)
return 1;
162 return sizeof(double);
170 return sizeof(
void *);
181 return ((
c >=
'a' &&
c <=
'z') || (
c >=
'A' &&
c <=
'Z'));
186 return ((
c >=
'a' &&
c <=
'z') || (
c >=
'A' &&
c <=
'Z') ||
187 (
c >=
'0' &&
c <=
'9') || (
c ==
'_') || (
c ==
'/'));
196 for(; ok && *name; name++)
if (!
validNextChar(*name)) ok = 0;
213 for(
int i=0;
i<lev;
i++)
246 const std::list<TypeCodeObjref *>& ltc)
259 if(std::string(
name)==
"")
261 typname=
"seq"+std::string(content->
name());
262 name=typname.c_str();
264 if(std::string(
id)==
"")
276 _name(other._name),_repoId(other._repoId),
277 _shortName(other._shortName)
282 _repoId(repositoryId),_name(name)
284 string::size_type debut =
_name.find_last_of(
'/');
285 if(debut == std::string::npos)
302 list<TypeCodeObjref *>::iterator iter;
334 return _name.c_str();
347 list<TypeCodeObjref *>::const_iterator iter;
360 list<TypeCodeObjref *>::const_iterator iter;
363 if ((*iter)->isA(
id))
return 1;
375 return isA(tc->
id());
403 _listOfBases(other._listOfBases)
405 list<TypeCodeObjref *>::const_iterator iter;
448 return sizeof(
void*);
463 return _name.c_str();
514 _content(tc._content)
532 unsigned staticLgth) :
TypeCodeComposed(
Array,repositoryId,name), _content(content),_staticLgth(staticLgth)
569 return _name.c_str();
625 _content(tc._content),
626 _staticLgth(tc._staticLgth)
651 for(vector< pair<string,TypeCode*> >::iterator iter=
_members.begin();iter!=
_members.end();iter++)
652 (*iter).second->decrRef();
662 for(vector< std::pair<std::string,TypeCode*> >::iterator iter=
_members.begin();iter!=
_members.end();iter++)
688 return _name.c_str();
699 for(vector< pair<string,TypeCode*> >::const_iterator iter=
_members.begin();iter!=
_members.end();iter++)
700 ret+=(*iter).second->getSizeInByteOfAnyReprInSeq();
706 const char what[]=
"Content type is specified by giving a key.";
732 for(
int i=0;
i<nMember;
i++)
752 for (
int i=0 ;
i<nMember ;
i++)
772 for(
int i=0;
i<nMember;
i++)
784 std::vector< std::pair<std::string,TypeCode*> >::const_iterator iter;
787 if((*iter).first ==
name)
788 throw Exception(
"Struct member " +
name +
" already defined");
790 _members.push_back(std::pair<std::string,TypeCode*>(
name,tc));
803 std::vector< std::pair<std::string,TypeCode*> >::const_iterator iter;
807 if((*iter).first==
name)
808 return (*iter).second;
824 msg <<
"Struct size less than " << index;
825 msg <<
" : " << __FILE__ <<
":" << __LINE__;
828 return _members[index].first.c_str();
836 msg <<
"Struct size less than " << index;
837 msg <<
" : " << __FILE__ <<
":" << __LINE__;
static void checkValidName(const char *name)
static int validChar0(char c)
static int validNextChar(char c)
: Allow to manage memory of instances of T. The only constraint on T is to have method incrRef and De...
static AnyPtr getOrBuildFromData(char *data, const TypeCodeArray *type)
static void destroyReprAtPlace(char *data, const TypeCodeArray *type)
static void putReprAtPlace(char *data, const char *src, const TypeCodeArray *type, bool deepCpy)
static void putReprAtPlace(char *data, const char *src, const TypeCode *type, bool deepCpy)
static AnyPtr getOrBuildFromData(char *data, const TypeCode *type)
static void destroyReprAtPlace(char *data, const TypeCode *type)
static void putReprAtPlace(char *data, const char *src, const TypeCode *type, bool deepCpy)
static void destroyReprAtPlace(char *data, const TypeCode *type)
static AnyPtr getOrBuildFromData(char *data, const TypeCode *type)
static AnyPtr getOrBuildFromData(char *data, const TypeCodeStruct *type)
static void putReprAtPlace(char *data, const char *src, const TypeCodeStruct *type, bool deepCpy)
static void destroyReprAtPlace(char *data, const TypeCodeStruct *type)
const char * name() const
TypeCodeArray(const char *repositoryId, const char *name, const TypeCode *content, unsigned staticLgth)
Create an Array type with a given name, a given id and a given contained type.
AnyPtr getOrBuildAnyFromZippedData(char *data) const
virtual const TypeCode * contentType() const
const TypeCode * _content
void putReprAtPlace(char *pt, const char *val, bool deepCpy) const
virtual int isEquivalent(const TypeCode *tc) const
Check if this TypeCode can be used in place of tc.
void destroyZippedAny(char *data) const
unsigned getSizeInByteOfAnyReprInSeq() const
unsigned getStaticLgth() const
virtual int isAdaptable(const TypeCode *tc) const
Check if this TypeCode is adaptable to a given TypeCode (tc)
const char * shortName() const
const unsigned _staticLgth
virtual int isA(const TypeCode *tc) const
TypeCodeComposed(const TypeCodeComposed &other)
const std::string _repoId
Class for reference objects.
virtual ~TypeCodeObjref()
void putReprAtPlace(char *pt, const char *val, bool deepCpy) const
int isA(const char *repositoryId) const
Check if this TypeCode is derived from a TypeCode with a given id.
const char * shortName() const
std::list< TypeCodeObjref * > _listOfBases
const char * name() const
virtual int isAdaptable(const TypeCode *tc) const
Check if this TypeCode is adaptable to a given TypeCode (tc)
TypeCodeObjref(const char *repositoryId, const char *name)
AnyPtr getOrBuildAnyFromZippedData(char *data) const
virtual int isEquivalent(const TypeCode *tc) const
Check if this TypeCode can be used in place of tc.
void destroyZippedAny(char *data) const
Class for sequence objects.
virtual std::string getPrintStr() const
void destroyZippedAny(char *data) const
const char * name() const
virtual int isEquivalent(const TypeCode *tc) const
Check if this TypeCode can be used in place of tc.
virtual const TypeCode * contentType() const
TypeCodeSeq(const char *repositoryId, const char *name, const TypeCode *content)
Create a sequence type with a given name, a given id and a given contained type.
virtual unsigned getSizeInByteOfAnyReprInSeq() const
void putReprAtPlace(char *pt, const char *val, bool deepCpy) const
const char * shortName() const
virtual int isAdaptable(const TypeCode *tc) const
Check if this TypeCode is adaptable to a given TypeCode (tc)
const TypeCode * _content
virtual int isA(const TypeCode *tc) const
AnyPtr getOrBuildAnyFromZippedData(char *data) const
const char * memberName(int index) const
const TypeCode * contentType() const
TypeCodeStruct(const char *repositoryId, const char *name)
Create a struct type with a given name and a given id.
virtual void addMember(const std::string &name, TypeCode *tc)
The only non const method.
void destroyZippedAny(char *data) const
virtual ~TypeCodeStruct()
virtual int isEquivalent(const TypeCode *tc) const
Check if this TypeCode can be used in place of tc.
const char * name() const
const TypeCode * getMember(const std::string &name, unsigned &offset) const
Get typecode of struct member given its name.
void putReprAtPlace(char *pt, const char *val, bool deepCpy) const
TypeCode * memberType(int index) const
virtual unsigned getSizeInByteOfAnyReprInSeq() const
virtual int isA(const char *repositoryId) const
Check if this TypeCode is derived from a TypeCode with a given id.
std::vector< std::pair< std::string, TypeCode * > > _members
AnyPtr getOrBuildAnyFromZippedData(char *data) const
virtual int isAdaptable(const TypeCode *tc) const
Check if this TypeCode is adaptable to a given TypeCode (tc)
const char * shortName() const
Base class for all type objects.
virtual const char * name() const
static TypeCode * interfaceTc(const char *id, const char *name)
static factory of object reference type given an id and a name
virtual void destroyZippedAny(char *data) const
virtual const char * id() const
virtual const TypeCode * contentType() const
virtual int isA(const char *repositoryId) const
virtual unsigned getSizeInByteOfAnyReprInSeq() const
static TypeCode * sequenceTc(const char *id, const char *name, TypeCode *content)
static factory of sequence type given an id, a name and a content type
virtual int isEquivalent(const TypeCode *tc) const
Check if this TypeCode can be used in place of tc.
static const char * KIND_STR_REPR[]
virtual int isAdaptable(const TypeCode *tc) const
Check if this TypeCode is adaptable to a given TypeCode (tc)
virtual TypeCode * clone() const
static TypeCode * structTc(const char *id, const char *name)
static factory of struct type given an id and a name
virtual std::string getPrintStr() const
const TypeCode * subContentType(int lev) const
virtual void putReprAtPlace(char *pt, const char *val, bool deepCpy) const
const char * getKindRepr() const
virtual const char * shortName() const
virtual AnyPtr getOrBuildAnyFromZippedData(char *data) const