Version: 9.15.0
YACS::ENGINE::TypeCodeArray Class Reference

Class for array objects. More...

#include <TypeCode.hxx>

Inheritance diagram for YACS::ENGINE::TypeCodeArray:
Collaboration diagram for YACS::ENGINE::TypeCodeArray:

Public Member Functions

 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. More...
 
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
 
unsigned getStaticLgth () 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...
 
unsigned getSizeInByteOfAnyReprInSeq () const
 
- 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
 
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 ~TypeCodeArray ()
 
 TypeCodeArray (const TypeCodeArray &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
 
const unsigned _staticLgth
 

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

Definition at line 192 of file TypeCode.hxx.

Constructor & Destructor Documentation

◆ TypeCodeArray() [1/2]

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

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

Definition at line 529 of file TypeCode.cxx.

532  : TypeCodeComposed(Array,repositoryId,name), _content(content),_staticLgth(staticLgth)
533 {
534  _content->incrRef();
535 }
const char * name() const
Definition: TypeCode.cxx:567
const TypeCode * _content
Definition: TypeCode.hxx:216
const unsigned _staticLgth
Definition: TypeCode.hxx:217
TypeCodeComposed(const TypeCodeComposed &other)
Definition: TypeCode.cxx:275

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

Referenced by clone().

◆ ~TypeCodeArray()

TypeCodeArray::~TypeCodeArray ( )
protectedvirtual

Definition at line 537 of file TypeCode.cxx.

538 {
539  ((TypeCode *)_content)->decrRef();
540 }
Base class for all type objects.
Definition: TypeCode.hxx:68

References _content.

◆ TypeCodeArray() [2/2]

TypeCodeArray::TypeCodeArray ( const TypeCodeArray tc)
protected

Definition at line 624 of file TypeCode.cxx.

624  :TypeCodeComposed(tc),
625  _content(tc._content),
627 {
628  _content->incrRef();
629 }

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

Member Function Documentation

◆ clone()

TypeCode * TypeCodeArray::clone ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 542 of file TypeCode.cxx.

543 {
544  return new TypeCodeArray(*this);
545 }
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.
Definition: TypeCode.cxx:529

References TypeCodeArray().

◆ contentType()

const TypeCode * TypeCodeArray::contentType ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 581 of file TypeCode.cxx.

582 {
583  return _content;
584 }

References _content.

Referenced by YACS::ENGINE::ArrayAny::destroyReprAtPlace(), isAdaptable(), and YACS::ENGINE::ArrayAny::putReprAtPlace().

◆ destroyZippedAny()

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

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 552 of file TypeCode.cxx.

553 {
554  ArrayAny::destroyReprAtPlace(data,this);
555 }
static void destroyReprAtPlace(char *data, const TypeCodeArray *type)
Definition: Any.cxx:1034

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

◆ getOrBuildAnyFromZippedData()

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

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 557 of file TypeCode.cxx.

558 {
559  return ArrayAny::getOrBuildFromData(data,this);
560 }
static AnyPtr getOrBuildFromData(char *data, const TypeCodeArray *type)
Definition: Any.cxx:1042

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

◆ getSizeInByteOfAnyReprInSeq()

unsigned TypeCodeArray::getSizeInByteOfAnyReprInSeq ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 631 of file TypeCode.cxx.

632 {
634 }
virtual unsigned getSizeInByteOfAnyReprInSeq() const
Definition: TypeCode.cxx:157

References _content, _staticLgth, and YACS::ENGINE::TypeCode::getSizeInByteOfAnyReprInSeq().

◆ getStaticLgth()

unsigned TypeCodeArray::getStaticLgth ( ) const

◆ id()

const char * TypeCodeArray::id ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 562 of file TypeCode.cxx.

563 {
564  return _repoId.c_str();
565 }
const std::string _repoId
Definition: TypeCode.hxx:115

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

◆ isA()

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

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 586 of file TypeCode.cxx.

587 {
588  if(_kind == tc->kind())
589  if(_content->isA(tc->contentType()))
590  {
591  const TypeCodeArray *tcC=dynamic_cast<const TypeCodeArray *>(tc);
592  if(tcC)
593  return tcC->getStaticLgth()==_staticLgth;
594  return 0;
595  }
596  return 0;
597 }
Class for array objects.
Definition: TypeCode.hxx:193
unsigned getStaticLgth() const
Definition: TypeCode.cxx:576
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, _staticLgth, YACS::ENGINE::TypeCode::contentType(), getStaticLgth(), YACS::ENGINE::TypeCode::isA(), and YACS::ENGINE::TypeCode::kind().

◆ isAdaptable()

int TypeCodeArray::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 604 of file TypeCode.cxx.

605 {
606  if(_kind == tc->kind())
607  return contentType()->isAdaptable(tc->contentType());
608  return 0;
609 }
virtual const TypeCode * contentType() const
Definition: TypeCode.cxx:581
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 TypeCodeArray::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 617 of file TypeCode.cxx.

618 {
619  if(_kind == tc->kind())
620  return _content->isEquivalent(tc->contentType());
621  return 0;
622 }
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 * TypeCodeArray::name ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 567 of file TypeCode.cxx.

568 {
569  return _name.c_str();
570 }

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

◆ putReprAtPlace()

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

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 547 of file TypeCode.cxx.

548 {
549  ArrayAny::putReprAtPlace(pt,val,this,deepCpy);
550 }
static void putReprAtPlace(char *data, const char *src, const TypeCodeArray *type, bool deepCpy)
Definition: Any.cxx:1026

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

◆ shortName()

const char * TypeCodeArray::shortName ( ) const
virtual

Reimplemented from YACS::ENGINE::TypeCode.

Definition at line 571 of file TypeCode.cxx.

572 {
573  return _shortName.c_str();
574 }

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

Member Data Documentation

◆ _content

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

◆ _staticLgth

const unsigned YACS::ENGINE::TypeCodeArray::_staticLgth
private

Definition at line 217 of file TypeCode.hxx.

Referenced by getSizeInByteOfAnyReprInSeq(), getStaticLgth(), and isA().


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