Version: 9.12.0
YACS::ENGINE::TypeCodeObjref Class Reference

Class for reference objects. More...

#include <TypeCode.hxx>

Inheritance diagram for YACS::ENGINE::TypeCodeObjref:
Collaboration diagram for YACS::ENGINE::TypeCodeObjref:

Public Member Functions

 TypeCodeObjref (const char *repositoryId, const char *name)
 
 TypeCodeObjref (const char *repositoryId, const char *name, const std::list< TypeCodeObjref * > &ltc)
 
TypeCodeclone () const
 
void putReprAtPlace (char *pt, const char *val, bool deepCpy) const
 
void destroyZippedAny (char *data) const
 
AnyPtr getOrBuildAnyFromZippedData (char *data) const
 
const char * id () const
 
const char * name () const
 
const char * shortName () const
 
int isA (const char *repositoryId) const
 Check if this TypeCode is derived from a TypeCode with a given id. More...
 
virtual int isA (const TypeCode *tc) const
 Check if this TypeCode is derived from a given TypeCode. More...
 
virtual int isAdaptable (const TypeCode *tc) const
 Check if this TypeCode is adaptable to a given TypeCode (tc) More...
 
virtual int isEquivalent (const TypeCode *tc) const
 Check if this TypeCode can be used in place of tc. More...
 
- Public Member Functions inherited from YACS::ENGINE::TypeCode
 TypeCode (DynType kind)
 
DynType kind () const
 
const char * getKindRepr () const
 
const TypeCodesubContentType (int lev) const
 
virtual const TypeCodecontentType () const
 
virtual unsigned getSizeInByteOfAnyReprInSeq () const
 
virtual std::string getPrintStr () const
 
- Public Member Functions inherited from YACS::ENGINE::RefCounter
unsigned int getRefCnt () const
 
void incrRef () const
 
bool decrRef () const
 

Protected Member Functions

virtual ~TypeCodeObjref ()
 
 TypeCodeObjref (const TypeCodeObjref &other)
 
- Protected Member Functions inherited from YACS::ENGINE::TypeCodeComposed
 TypeCodeComposed (const TypeCodeComposed &other)
 
 TypeCodeComposed (DynType kind, const char *repositoryId, const char *name)
 
- Protected Member Functions inherited from YACS::ENGINE::TypeCode
 TypeCode (const TypeCode &tc)
 
TypeCodeoperator= (const TypeCode &tc)
 
virtual ~TypeCode ()
 
- Protected Member Functions inherited from YACS::ENGINE::RefCounter
 RefCounter ()
 
 RefCounter (const RefCounter &other)
 
virtual ~RefCounter ()
 

Private Attributes

std::list< TypeCodeObjref * > _listOfBases
 

Friends

class Visitor
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::TypeCode
static const char * getKindRepr (DynType kind)
 
static TypeCodeinterfaceTc (const char *id, const char *name)
 static factory of object reference type given an id and a name More...
 
static TypeCodeinterfaceTc (const char *id, const char *name, const std::list< TypeCodeObjref * > &ltc)
 static factory of object reference type given an id, a name and a list of base types More...
 
static TypeCodesequenceTc (const char *id, const char *name, TypeCode *content)
 static factory of sequence type given an id, a name and a content type More...
 
static TypeCodestructTc (const char *id, const char *name)
 static factory of struct type given an id and a name More...
 
- Static Public Attributes inherited from YACS::ENGINE::RefCounter
static unsigned int _totalCnt =0
 
- Protected Attributes inherited from YACS::ENGINE::TypeCodeComposed
const std::string _name
 
const std::string _repoId
 
std::string _shortName
 
- Protected Attributes inherited from YACS::ENGINE::TypeCode
const DynType _kind
 
- Protected Attributes inherited from YACS::ENGINE::RefCounter
unsigned int _cnt
 
- Static Protected Attributes inherited from YACS::ENGINE::TypeCode
static const char * KIND_STR_REPR [] ={ "None", "double", "int", "string", "bool", "Objref", "Sequence", "Array","Struct" }
 

Detailed Description

Class for reference objects.

Definition at line 125 of file TypeCode.hxx.

Constructor & Destructor Documentation

◆ TypeCodeObjref() [1/3]

TypeCodeObjref::TypeCodeObjref ( const char *  repositoryId,
const char *  name 
)

Definition at line 294 of file TypeCode.cxx.

295  : TypeCodeComposed(Objref,repositoryId,name)
296 {
297 }
TypeCodeComposed(const TypeCodeComposed &other)
Definition: TypeCode.cxx:275
const char * name() const
Definition: TypeCode.cxx:332

Referenced by clone().

◆ TypeCodeObjref() [2/3]

TypeCodeObjref::TypeCodeObjref ( const char *  repositoryId,
const char *  name,
const std::list< TypeCodeObjref * > &  ltc 
)

Definition at line 342 of file TypeCode.cxx.

344  : TypeCodeComposed(Objref,repositoryId,name)
345 {
346  _listOfBases=ltc;
347  list<TypeCodeObjref *>::const_iterator iter;
348  for(iter=_listOfBases.begin();iter != _listOfBases.end(); iter++)
349  (*iter)->incrRef();
350 }
std::list< TypeCodeObjref * > _listOfBases
Definition: TypeCode.hxx:150

References _listOfBases.

◆ ~TypeCodeObjref()

TypeCodeObjref::~TypeCodeObjref ( )
protectedvirtual

Definition at line 300 of file TypeCode.cxx.

301 {
302  list<TypeCodeObjref *>::iterator iter;
303  for(iter=_listOfBases.begin();iter != _listOfBases.end(); iter++)
304  (*iter)->decrRef();
305 }

References _listOfBases.

◆ TypeCodeObjref() [3/3]

TypeCodeObjref::TypeCodeObjref ( const TypeCodeObjref other)
protected

Definition at line 402 of file TypeCode.cxx.

402  :TypeCodeComposed(other),
404 {
405  list<TypeCodeObjref *>::const_iterator iter;
406  for(iter=other._listOfBases.begin();iter!=other._listOfBases.end();iter++)
407  (*iter)->incrRef();
408 }

References _listOfBases, and YACS::ENGINE::RefCounter::incrRef().

Member Function Documentation

◆ clone()

TypeCode * TypeCodeObjref::clone ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 307 of file TypeCode.cxx.

308 {
309  return new TypeCodeObjref(*this);
310 }
TypeCodeObjref(const char *repositoryId, const char *name)
Definition: TypeCode.cxx:294

References TypeCodeObjref().

◆ destroyZippedAny()

void TypeCodeObjref::destroyZippedAny ( char *  data) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 317 of file TypeCode.cxx.

318 {
319  AtomAny::destroyReprAtPlace(data,this);
320 }
static void destroyReprAtPlace(char *data, const TypeCode *type)
Definition: Any.cxx:468

References YACS::ENGINE::AtomAny::destroyReprAtPlace().

◆ getOrBuildAnyFromZippedData()

AnyPtr TypeCodeObjref::getOrBuildAnyFromZippedData ( char *  data) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 322 of file TypeCode.cxx.

323 {
324  return AtomAny::getOrBuildFromData(data,this);
325 }
static AnyPtr getOrBuildFromData(char *data, const TypeCode *type)
Definition: Any.cxx:481

References YACS::ENGINE::AtomAny::getOrBuildFromData().

◆ id()

const char * TypeCodeObjref::id ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 327 of file TypeCode.cxx.

328 {
329  return _repoId.c_str();
330 };
const std::string _repoId
Definition: TypeCode.hxx:115

References YACS::ENGINE::TypeCodeComposed::_repoId.

Referenced by YACS::ENGINE::VisitorSaveSchema::dumpTypeCode().

◆ isA() [1/2]

int TypeCodeObjref::isA ( const char *  id) const
virtual

Check if this TypeCode is derived from a TypeCode with a given id.

Parameters
id: a given id
Returns
1 if true, 0 if false

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 357 of file TypeCode.cxx.

358 {
359  if(_repoId == id)return 1;
360  list<TypeCodeObjref *>::const_iterator iter;
361  for(iter=_listOfBases.begin();iter != _listOfBases.end(); iter++)
362  {
363  if ((*iter)->isA(id)) return 1;
364  }
365  return 0;
366 }

References _listOfBases, and YACS::ENGINE::TypeCodeComposed::_repoId.

Referenced by isA(), and isAdaptable().

◆ isA() [2/2]

int TypeCodeObjref::isA ( const TypeCode tc) const
virtual

Check if this TypeCode is derived from a given TypeCode.

Parameters
tc: the given TypeCode
Returns
1 if true, 0 if false

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 373 of file TypeCode.cxx.

374 {
375  return isA(tc->id());
376 }
int isA(const char *repositoryId) const
Check if this TypeCode is derived from a TypeCode with a given id.
Definition: TypeCode.cxx:357
virtual const char * id() const
Definition: TypeCode.cxx:82

References YACS::ENGINE::TypeCode::id(), and isA().

◆ isAdaptable()

int TypeCodeObjref::isAdaptable ( const TypeCode tc) const
virtual

Check if this TypeCode is adaptable to a given TypeCode (tc)

Parameters
tc: the given TypeCode
Returns
1 if true, 0 if false

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 383 of file TypeCode.cxx.

384 {
385  if(_kind == tc->kind()) return isA(tc->id());
386  return 0;
387 }
DynType kind() const
Definition: TypeCode.cxx:47
const DynType _kind
Definition: TypeCode.hxx:104

References YACS::ENGINE::TypeCode::_kind, YACS::ENGINE::TypeCode::id(), isA(), and YACS::ENGINE::TypeCode::kind().

◆ isEquivalent()

int TypeCodeObjref::isEquivalent ( const TypeCode tc) const
virtual

Check if this TypeCode can be used in place of tc.

this TypeCode is equivalent to tc if they have the same kind

Parameters
tc: the TypeCode to compare

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 395 of file TypeCode.cxx.

396 {
397  if(_kind != tc->kind())return 0;
398  if(_repoId == tc->id())return 1;
399  return 0;
400 }

References YACS::ENGINE::TypeCode::_kind, YACS::ENGINE::TypeCodeComposed::_repoId, YACS::ENGINE::TypeCode::id(), and YACS::ENGINE::TypeCode::kind().

◆ name()

const char * TypeCodeObjref::name ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 332 of file TypeCode.cxx.

333 {
334  return _name.c_str();
335 }

References YACS::ENGINE::TypeCodeComposed::_name.

◆ putReprAtPlace()

void TypeCodeObjref::putReprAtPlace ( char *  pt,
const char *  val,
bool  deepCpy 
) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 312 of file TypeCode.cxx.

313 {
314  AtomAny::putReprAtPlace(pt,val,this,deepCpy);
315 }
static void putReprAtPlace(char *data, const char *src, const TypeCode *type, bool deepCpy)
Definition: Any.cxx:448

References YACS::ENGINE::AtomAny::putReprAtPlace().

◆ shortName()

const char * TypeCodeObjref::shortName ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 337 of file TypeCode.cxx.

338 {
339  return _shortName.c_str();
340 }

References YACS::ENGINE::TypeCodeComposed::_shortName.

Friends And Related Function Documentation

◆ Visitor

friend class Visitor
friend

Definition at line 127 of file TypeCode.hxx.

Member Data Documentation

◆ _listOfBases

std::list<TypeCodeObjref *> YACS::ENGINE::TypeCodeObjref::_listOfBases
private

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