Version: 9.15.0
YACS::ENGINE::TypeCodeSeq Class Reference

Class for sequence objects. More...

#include <TypeCode.hxx>

Inheritance diagram for YACS::ENGINE::TypeCodeSeq:
Collaboration diagram for YACS::ENGINE::TypeCodeSeq:

Public Member Functions

 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. More...
 
TypeCodeclone () const
 
void putReprAtPlace (char *pt, const char *val, bool deepCpy) const
 
void destroyZippedAny (char *data) const
 
virtual unsigned getSizeInByteOfAnyReprInSeq () const
 
AnyPtr getOrBuildAnyFromZippedData (char *data) const
 
const char * id () const
 
const char * name () const
 
const char * shortName () const
 
virtual std::string getPrintStr () const
 
virtual const TypeCodecontentType () const
 
virtual int isA (const TypeCode *tc) const
 
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 int isA (const char *repositoryId) const
 
- Public Member Functions inherited from YACS::ENGINE::RefCounter
unsigned int getRefCnt () const
 
void incrRef () const
 
bool decrRef () const
 

Protected Member Functions

virtual ~TypeCodeSeq ()
 
 TypeCodeSeq (const TypeCodeSeq &tc)
 
- 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

const TypeCode_content
 

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 sequence objects.

Definition at line 159 of file TypeCode.hxx.

Constructor & Destructor Documentation

◆ TypeCodeSeq() [1/2]

TypeCodeSeq::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.

Parameters
repositoryId: the given id
name: the given name
content: the given contained TypeCode

Definition at line 419 of file TypeCode.cxx.

421  : TypeCodeComposed(Sequence,repositoryId,name), _content(content)
422 {
423  _content->incrRef();
424 }
TypeCodeComposed(const TypeCodeComposed &other)
Definition: TypeCode.cxx:275
const char * name() const
Definition: TypeCode.cxx:461
const TypeCode * _content
Definition: TypeCode.hxx:184

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

Referenced by clone().

◆ ~TypeCodeSeq()

TypeCodeSeq::~TypeCodeSeq ( )
protectedvirtual

Definition at line 426 of file TypeCode.cxx.

427 {
428  ((TypeCode *)_content)->decrRef();
429 }
Base class for all type objects.
Definition: TypeCode.hxx:68

References _content.

◆ TypeCodeSeq() [2/2]

TypeCodeSeq::TypeCodeSeq ( const TypeCodeSeq tc)
protected

Definition at line 513 of file TypeCode.cxx.

513  :TypeCodeComposed(tc),
514  _content(tc._content)
515 {
516  _content->incrRef();
517 }

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

Member Function Documentation

◆ clone()

TypeCode * TypeCodeSeq::clone ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 431 of file TypeCode.cxx.

432 {
433  return new TypeCodeSeq(*this);
434 }
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.
Definition: TypeCode.cxx:419

References TypeCodeSeq().

◆ contentType()

const TypeCode * TypeCodeSeq::contentType ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 476 of file TypeCode.cxx.

477 {
478  return _content;
479 }

References _content.

Referenced by YACS::ENGINE::isAdaptableObjref< IMPLIN, IMPLOUT >::apply(), getPrintStr(), and isAdaptable().

◆ destroyZippedAny()

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

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 441 of file TypeCode.cxx.

442 {
444 }
static void destroyReprAtPlace(char *data, const TypeCode *type)
Definition: Any.cxx:737

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

◆ getOrBuildAnyFromZippedData()

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

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 451 of file TypeCode.cxx.

452 {
453  return SequenceAny::getOrBuildFromData(data,this);
454 }
static AnyPtr getOrBuildFromData(char *data, const TypeCode *type)
Definition: Any.cxx:745

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

◆ getPrintStr()

std::string TypeCodeSeq::getPrintStr ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 470 of file TypeCode.cxx.

471 {
472  std::ostringstream oss; oss << "seq[" << contentType()->getPrintStr() << "]";
473  return oss.str();
474 }
virtual const TypeCode * contentType() const
Definition: TypeCode.cxx:476
virtual std::string getPrintStr() const
Definition: TypeCode.cxx:140

References contentType(), and YACS::ENGINE::TypeCode::getPrintStr().

◆ getSizeInByteOfAnyReprInSeq()

unsigned TypeCodeSeq::getSizeInByteOfAnyReprInSeq ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 446 of file TypeCode.cxx.

447 {
448  return sizeof(void*);
449 }

◆ id()

const char * TypeCodeSeq::id ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 456 of file TypeCode.cxx.

457 {
458  return _repoId.c_str();
459 }
const std::string _repoId
Definition: TypeCode.hxx:115

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

◆ isA()

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

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 481 of file TypeCode.cxx.

482 {
483  if(_kind == tc->kind())
484  return _content->isA(tc->contentType());
485  return 0;
486 }
virtual const TypeCode * contentType() const
Definition: TypeCode.cxx:174
virtual int isA(const char *repositoryId) const
Definition: TypeCode.cxx:99
DynType kind() const
Definition: TypeCode.cxx:47
const DynType _kind
Definition: TypeCode.hxx:104

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

◆ isAdaptable()

int TypeCodeSeq::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 493 of file TypeCode.cxx.

494 {
495  if(_kind == tc->kind())
496  return contentType()->isAdaptable(tc->contentType());
497  return 0;
498 }
virtual int isAdaptable(const TypeCode *tc) const
Check if this TypeCode is adaptable to a given TypeCode (tc)
Definition: TypeCode.cxx:116

References YACS::ENGINE::TypeCode::_kind, YACS::ENGINE::TypeCode::contentType(), contentType(), YACS::ENGINE::TypeCode::isAdaptable(), and YACS::ENGINE::TypeCode::kind().

◆ isEquivalent()

int TypeCodeSeq::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 506 of file TypeCode.cxx.

507 {
508  if(_kind == tc->kind())
509  return _content->isEquivalent(tc->contentType());
510  return 0;
511 }
virtual int isEquivalent(const TypeCode *tc) const
Check if this TypeCode can be used in place of tc.
Definition: TypeCode.cxx:151

References _content, YACS::ENGINE::TypeCode::_kind, YACS::ENGINE::TypeCode::contentType(), YACS::ENGINE::TypeCode::isEquivalent(), and YACS::ENGINE::TypeCode::kind().

◆ name()

const char * TypeCodeSeq::name ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 461 of file TypeCode.cxx.

462 {
463  return _name.c_str();
464 }

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

◆ putReprAtPlace()

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

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 436 of file TypeCode.cxx.

437 {
438  SequenceAny::putReprAtPlace(pt,val,this,deepCpy);
439 }
static void putReprAtPlace(char *data, const char *src, const TypeCode *type, bool deepCpy)
Definition: Any.cxx:721

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

◆ shortName()

const char * TypeCodeSeq::shortName ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 465 of file TypeCode.cxx.

466 {
467  return _shortName.c_str();
468 }

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

Member Data Documentation

◆ _content

const TypeCode* YACS::ENGINE::TypeCodeSeq::_content
private

Definition at line 184 of file TypeCode.hxx.

Referenced by contentType(), isA(), isEquivalent(), TypeCodeSeq(), and ~TypeCodeSeq().


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