Version: 9.16.0
YACS::ENGINE::TypeCode Class Reference

Base class for all type objects. More...

#include <TypeCode.hxx>

Inheritance diagram for YACS::ENGINE::TypeCode:
Collaboration diagram for YACS::ENGINE::TypeCode:

Public Member Functions

 TypeCode (DynType kind)
 
DynType kind () const
 
const char * getKindRepr () const
 
const TypeCodesubContentType (int lev) const
 
virtual TypeCodeclone () const
 
virtual void putReprAtPlace (char *pt, const char *val, bool deepCpy) const
 
virtual void destroyZippedAny (char *data) const
 
virtual AnyPtr getOrBuildAnyFromZippedData (char *data) const
 
virtual const char * name () const
 
virtual const char * shortName () const
 
virtual const char * id () const
 
virtual const TypeCodecontentType () const
 
virtual int isA (const char *repositoryId) 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...
 
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
 

Static Public Member Functions

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

Protected Member Functions

 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 ()
 

Protected Attributes

const DynType _kind
 
- Protected Attributes inherited from YACS::ENGINE::RefCounter
unsigned int _cnt
 

Static Protected Attributes

static const char * KIND_STR_REPR [] ={ "None", "double", "int", "string", "bool", "Objref", "Sequence", "Array","Struct" }
 

Additional Inherited Members

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

Detailed Description

Base class for all type objects.

All type objects should be a subclass of TypeCode. Some type objects, TypeCodeObjref for example, represent one individual type. Other type objects, such as TypeCodeSeq, are composite types (sequence, here)

See also
TypeCodeObjref
TypeCodeSeq
TypeCodeStruct
TypeCodeArray

Definition at line 67 of file TypeCode.hxx.

Constructor & Destructor Documentation

◆ TypeCode() [1/2]

TypeCode::TypeCode ( DynType  kind)

Definition at line 35 of file TypeCode.cxx.

35 :_kind(kind)
36{
37}
DynType kind() const
Definition: TypeCode.cxx:47
const DynType _kind
Definition: TypeCode.hxx:104

Referenced by clone().

◆ TypeCode() [2/2]

TypeCode::TypeCode ( const TypeCode tc)
protected

Definition at line 39 of file TypeCode.cxx.

39 :_kind(tc._kind)
40{
41}

◆ ~TypeCode()

TypeCode::~TypeCode ( )
protectedvirtual

Definition at line 43 of file TypeCode.cxx.

44{
45}

Member Function Documentation

◆ clone()

TypeCode * TypeCode::clone ( ) const
virtual

Reimplemented in YACS::ENGINE::TypeCodeObjref, YACS::ENGINE::TypeCodeSeq, YACS::ENGINE::TypeCodeArray, and YACS::ENGINE::TypeCodeStruct.

Definition at line 52 of file TypeCode.cxx.

53{
54 return new TypeCode(*this);
55}
TypeCode(DynType kind)
Definition: TypeCode.cxx:35

References TypeCode().

Referenced by YACS::HMI::SubjectProc::addSubjectDataType().

◆ contentType()

◆ destroyZippedAny()

◆ getKindRepr() [1/2]

const char * TypeCode::getKindRepr ( ) const

Definition at line 223 of file TypeCode.cxx.

224{
225 return KIND_STR_REPR[(int)_kind];
226}
static const char * KIND_STR_REPR[]
Definition: TypeCode.hxx:105

References _kind, and KIND_STR_REPR.

Referenced by YACS::ENGINE::InvalidExtractionException::InvalidExtractionException().

◆ getKindRepr() [2/2]

const char * TypeCode::getKindRepr ( DynType  kind)
static

Definition at line 201 of file TypeCode.cxx.

202{
203 return KIND_STR_REPR[(int)kind];
204}

References kind(), and KIND_STR_REPR.

◆ getOrBuildAnyFromZippedData()

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

◆ getPrintStr()

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

Reimplemented in YACS::ENGINE::TypeCodeSeq.

Definition at line 140 of file TypeCode.cxx.

141{
142 return id();
143}
virtual const char * id() const
Definition: TypeCode.cxx:82

References id().

Referenced by YACS::ENGINE::TypeCodeSeq::getPrintStr().

◆ getSizeInByteOfAnyReprInSeq()

◆ id()

const char * TypeCode::id ( ) const
virtual

Reimplemented in YACS::ENGINE::TypeCodeObjref, YACS::ENGINE::TypeCodeSeq, YACS::ENGINE::TypeCodeArray, and YACS::ENGINE::TypeCodeStruct.

Definition at line 82 of file TypeCode.cxx.

83{
84 switch(_kind)
85 {
86 case Double:
87 return "double";
88 case Int:
89 return "int";
90 case String:
91 return "string";
92 case Bool:
93 return "bool";
94 default:
95 return "";
96 }
97}

References _kind, YACS::ENGINE::Bool, YACS::ENGINE::Double, YACS::ENGINE::Int, and YACS::ENGINE::String.

Referenced by YACS::ENGINE::RuntimeSALOME::adaptCorbaToCorba(), YACS::ENGINE::RuntimeSALOME::adaptCorbaToCpp(), YACS::ENGINE::RuntimeSALOME::adaptCorbaToNeutral(), YACS::ENGINE::RuntimeSALOME::adaptCorbaToPython(), YACS::ENGINE::RuntimeSALOME::adaptCorbaToXml(), YACS::ENGINE::RuntimeSALOME::adaptCppToCorba(), YACS::ENGINE::RuntimeSALOME::adaptCppToCpp(), YACS::ENGINE::RuntimeSALOME::adaptCppToNeutral(), YACS::ENGINE::RuntimeSALOME::adaptCppToPython(), YACS::ENGINE::RuntimeSALOME::adaptCppToXml(), YACS::ENGINE::RuntimeSALOME::adaptNeutralToCorba(), YACS::ENGINE::RuntimeSALOME::adaptNeutralToCpp(), YACS::ENGINE::RuntimeSALOME::adaptNeutralToPython(), YACS::ENGINE::RuntimeSALOME::adaptNeutralToXml(), YACS::ENGINE::RuntimeSALOME::adaptPythonToCorba(), YACS::ENGINE::RuntimeSALOME::adaptPythonToCpp(), YACS::ENGINE::RuntimeSALOME::adaptPythonToNeutral(), YACS::ENGINE::RuntimeSALOME::adaptPythonToPython(), YACS::ENGINE::RuntimeSALOME::adaptPythonToXml(), YACS::ENGINE::RuntimeSALOME::adaptXmlToCorba(), YACS::ENGINE::RuntimeSALOME::adaptXmlToCpp(), YACS::ENGINE::RuntimeSALOME::adaptXmlToPython(), YACS::ENGINE::RuntimeSALOME::adaptXmlToXml(), YACS::ENGINE::isAdaptableObjref< IMPLIN, IMPLOUT >::apply(), YACS::ENGINE::OutputDataStreamPort::edAddInputDataStreamPort(), getPrintStr(), YACS::ENGINE::TypeCodeObjref::isA(), YACS::ENGINE::TypeCodeStruct::isA(), YACS::ENGINE::TypeCodeObjref::isAdaptable(), YACS::ENGINE::TypeCodeStruct::isAdaptable(), YACS::ENGINE::TypeCodeObjref::isEquivalent(), name(), and shortName().

◆ interfaceTc() [1/2]

TypeCode * TypeCode::interfaceTc ( const char *  id,
const char *  name 
)
static

static factory of object reference type given an id and a name

Definition at line 229 of file TypeCode.cxx.

231{
233 return new TypeCodeObjref(id, name);
234};
static void checkValidName(const char *name)
Definition: TypeCode.cxx:190
Class for reference objects.
Definition: TypeCode.hxx:126
virtual const char * name() const
Definition: TypeCode.cxx:72

References checkValidName(), and name().

Referenced by YACS::ENGINE::Proc::createInterfaceTc(), YACS::ENGINE::Runtime::createInterfaceTc(), and YACS::ENGINE::RuntimeSALOME::createInterfaceTc().

◆ interfaceTc() [2/2]

TypeCode * TypeCode::interfaceTc ( const char *  id,
const char *  name,
const std::list< TypeCodeObjref * > &  ltc 
)
static

static factory of object reference type given an id, a name and a list of base types

Parameters
id: the id
name: the name
ltc: the list of base types

The name must be a valid one (throw Exception is not)

Definition at line 244 of file TypeCode.cxx.

247{
249 return new TypeCodeObjref(id, name,ltc);
250}

References checkValidName(), and name().

◆ isA() [1/2]

◆ isA() [2/2]

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

Reimplemented in YACS::ENGINE::TypeCodeObjref, YACS::ENGINE::TypeCodeSeq, YACS::ENGINE::TypeCodeArray, and YACS::ENGINE::TypeCodeStruct.

Definition at line 104 of file TypeCode.cxx.

105{
106 if(_kind == tc->kind()) return 1;
107 return 0;
108}

References _kind, and kind().

◆ isAdaptable()

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

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

this TypeCode is adaptable to tc if tc type can be converted to this type

Parameters
tc: the TypeCode that must be convertible to this

Reimplemented in YACS::ENGINE::TypeCodeObjref, YACS::ENGINE::TypeCodeSeq, YACS::ENGINE::TypeCodeArray, and YACS::ENGINE::TypeCodeStruct.

Definition at line 116 of file TypeCode.cxx.

117{
118 switch(_kind)
119 {
120 case Double:
121 if (tc->kind() == Double) return 1;
122 if (tc->kind() == Int) return 1;
123 return 0;
124 case Int:
125 if (tc->kind() == Int) return 1;
126 return 0;
127 case String:
128 if (tc->kind() == String) return 1;
129 return 0;
130 case Bool:
131 if (tc->kind() == Bool) return 1;
132 if (tc->kind() == Int) return 1;
133 return 0;
134 default:
135 //objref, sequence, ...
136 return 0;
137 }
138}

References _kind, YACS::ENGINE::Bool, YACS::ENGINE::Double, YACS::ENGINE::Int, kind(), and YACS::ENGINE::String.

Referenced by YACS::ENGINE::RuntimeSALOME::adaptCorbaToXml(), YACS::ENGINE::RuntimeSALOME::adaptCppToCpp(), YACS::ENGINE::RuntimeSALOME::adaptCppToNeutral(), YACS::ENGINE::RuntimeSALOME::adaptNeutralToCorba(), YACS::ENGINE::RuntimeSALOME::adaptNeutralToPython(), YACS::ENGINE::RuntimeSALOME::adaptNeutralToXml(), YACS::ENGINE::RuntimeSALOME::adaptPythonToXml(), YACS::ENGINE::RuntimeSALOME::adaptXmlToCpp(), YACS::ENGINE::RuntimeSALOME::adaptXmlToNeutral(), YACS::ENGINE::RuntimeSALOME::adaptXmlToPython(), YACS::ENGINE::RuntimeSALOME::adaptXmlToXml(), YACS::ENGINE::OutputDataStreamPort::edAddInputDataStreamPort(), YACS::ENGINE::TypeCodeSeq::isAdaptable(), and YACS::ENGINE::TypeCodeArray::isAdaptable().

◆ isEquivalent()

int TypeCode::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 in YACS::ENGINE::TypeCodeObjref, YACS::ENGINE::TypeCodeSeq, YACS::ENGINE::TypeCodeArray, and YACS::ENGINE::TypeCodeStruct.

Definition at line 151 of file TypeCode.cxx.

152{
153 if(_kind == tc->kind()) return 1;
154 return 0;
155}

References _kind, and kind().

Referenced by YACS::ENGINE::TypeCodeSeq::isEquivalent(), and YACS::ENGINE::TypeCodeArray::isEquivalent().

◆ kind()

DynType TypeCode::kind ( ) const

Definition at line 47 of file TypeCode.cxx.

48{
49 return _kind;
50}

References _kind.

Referenced by YACS::ENGINE::RuntimeSALOME::adaptCorbaToNeutral(), YACS::ENGINE::RuntimeSALOME::adaptCorbaToPython(), YACS::ENGINE::RuntimeSALOME::adaptCppToCpp(), YACS::ENGINE::RuntimeSALOME::adaptCppToNeutral(), YACS::ENGINE::RuntimeSALOME::adaptNeutralToPython(), YACS::ENGINE::RuntimeSALOME::adaptPythonToCorba(), YACS::ENGINE::RuntimeSALOME::adaptPythonToNeutral(), YACS::ENGINE::RuntimeSALOME::adaptXmlToCpp(), YACS::ENGINE::isAdaptableObjref< IMPLIN, IMPLOUT >::apply(), YACS::ENGINE::AtomAny::AtomAny(), YACS::ENGINE::convertToYacsDouble< CPPImpl, void *, const TypeCode *, IMPLOUT, TOUT >::convert(), YACS::ENGINE::convertToYacsInt< CPPImpl, void *, const TypeCode *, IMPLOUT, TOUT >::convert(), YACS::ENGINE::convertToYacsDouble< NEUTRALImpl, YACS::ENGINE::Any *, void *, IMPLOUT, TOUT >::convert(), YACS::ENGINE::convertToYacsInt< NEUTRALImpl, YACS::ENGINE::Any *, void *, IMPLOUT, TOUT >::convert(), YACS::ENGINE::convertToYacsString< NEUTRALImpl, YACS::ENGINE::Any *, void *, IMPLOUT, TOUT >::convert(), YACS::ENGINE::convertToYacsBool< NEUTRALImpl, YACS::ENGINE::Any *, void *, IMPLOUT, TOUT >::convert(), YACS::ENGINE::convertToYacsObjref< NEUTRALImpl, YACS::ENGINE::Any *, void *, IMPLOUT, TOUT >::convert(), YACS::HMI::ValueDelegate::createEditor(), YACS::ENGINE::RuntimeSALOME::createInputDataStreamPort(), YACS::ENGINE::RuntimeSALOME::createOutputDataStreamPort(), YACS::ENGINE::AtomAny::destroyReprAtPlace(), YACS::ENGINE::AnyInputPort::dump(), YACS::ENGINE::VisitorSaveSchema::dumpTypeCode(), YACS::ENGINE::OutputCorbaPort::getAnyOut(), YACS::ENGINE::ComposedAny::getBoolValue(), YACS::ENGINE::AtomAny::getBytesValue(), YACS::ENGINE::ComposedAny::getDoubleValue(), YACS::ENGINE::ComposedAny::getIntValue(), getKindRepr(), YACS::ENGINE::AtomAny::getStringValue(), YACS::ENGINE::ComposedAny::getStringValue(), isA(), YACS::ENGINE::TypeCodeSeq::isA(), YACS::ENGINE::TypeCodeArray::isA(), YACS::ENGINE::TypeCodeStruct::isA(), isAdaptable(), YACS::ENGINE::TypeCodeObjref::isAdaptable(), YACS::ENGINE::TypeCodeSeq::isAdaptable(), YACS::ENGINE::TypeCodeArray::isAdaptable(), YACS::ENGINE::TypeCodeStruct::isAdaptable(), isEquivalent(), YACS::ENGINE::TypeCodeObjref::isEquivalent(), YACS::ENGINE::TypeCodeSeq::isEquivalent(), YACS::ENGINE::TypeCodeArray::isEquivalent(), YACS::ENGINE::TypeCodeStruct::isEquivalent(), YACS::HMI::CommandSetInPortValue::localExecute(), YACS::HMI::CommandSetOutPortValue::localExecute(), YACS::HMI::CommandSetInPortValue::localReverse(), YACS::HMI::CommandSetOutPortValue::localReverse(), YACS::HMI::TreeView::onCommitData(), YACS::ENGINE::AtomAny::operator==(), YACS::ENGINE::AtomAny::operator[](), YACS::structtypeParser::post(), YACS::ENGINE::SequenceAny::pushBack(), YACS::ENGINE::XmlCorba::put(), YACS::ENGINE::OutputStudyPort::putIOR(), YACS::ENGINE::AtomAny::putMyReprAtPlace(), YACS::ENGINE::AtomAny::putReprAtPlace(), YACS::ENGINE::Proc::setInPortValue(), YACS::ENGINE::AtomAny::takeInChargeStorageOf(), YACS::ENGINE::SequenceAny::takeInChargeStorageOf(), YACS::ENGINE::ArrayAny::takeInChargeStorageOf(), and YACS::ENGINE::AtomAny::~AtomAny().

◆ name()

◆ operator=()

TypeCode & YACS::ENGINE::TypeCode::operator= ( const TypeCode tc)
protected

◆ putReprAtPlace()

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

◆ sequenceTc()

TypeCode * TypeCode::sequenceTc ( const char *  id,
const char *  name,
TypeCode content 
)
static

static factory of sequence type given an id, a name and a content type

Definition at line 254 of file TypeCode.cxx.

257{
258 std::string typname;
259 if(std::string(name)=="")
260 {
261 typname="seq"+std::string(content->name());
262 name=typname.c_str();
263 }
264 if(std::string(id)=="")
265 id=name;
266 return new TypeCodeSeq(id, name,content);
267};
Class for sequence objects.
Definition: TypeCode.hxx:160

References name().

Referenced by YACS::ENGINE::ForEachLoopGen::buildDelegateOf(), YACS::ENGINE::Proc::createSequenceTc(), YACS::ENGINE::Runtime::createSequenceTc(), and YACS::ENGINE::RuntimeSALOME::createSequenceTc().

◆ shortName()

const char * TypeCode::shortName ( ) const
virtual

◆ structTc()

TypeCode * TypeCode::structTc ( const char *  id,
const char *  name 
)
static

static factory of struct type given an id and a name

Definition at line 269 of file TypeCode.cxx.

271{
272 return new TypeCodeStruct(id, name);
273};
Class for struct type.
Definition: TypeCode.hxx:228

References name().

Referenced by YACS::ENGINE::Proc::createStructTc(), YACS::ENGINE::Runtime::createStructTc(), and YACS::ENGINE::RuntimeSALOME::createStructTc().

◆ subContentType()

const TypeCode * TypeCode::subContentType ( int  lev) const

Definition at line 206 of file TypeCode.cxx.

207{
208 if(lev<0)
209 throw YACS::Exception("subContentType: Invalid input val !");
210 if(lev==0)
211 return this;
212 const TypeCode *ret(this);
213 for(int i=0;i<lev;i++)
214 {
215 const TypeCode *cand(ret->contentType());
216 if(!cand)
217 throw YACS::Exception("subContentType : Invalid input val 2 !");
218 ret=cand;
219 }
220 return ret;
221}
Base class for all type objects.
Definition: TypeCode.hxx:68

References contentType(), and yacsorb.CORBAEngineTest::i.

Referenced by YACS::ENGINE::ForEachLoopGen::buildDelegateOf().

Member Data Documentation

◆ _kind

◆ KIND_STR_REPR

const char * TypeCode::KIND_STR_REPR ={ "None", "double", "int", "string", "bool", "Objref", "Sequence", "Array","Struct" }
staticprotected

Definition at line 105 of file TypeCode.hxx.

Referenced by getKindRepr().


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