Salome HOME
Updated copyright comment
[modules/yacs.git] / src / engine / TypeCode.hxx
index 1cdd434e75d4789764d031f279e3202b2340b680..ec5963252ce343fb80c9ae90303474c114adac93 100644 (file)
@@ -1,6 +1,26 @@
+// Copyright (C) 2006-2024  CEA, EDF
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
 #ifndef __TYPECODE_HXX__
 #define __TYPECODE_HXX__
 
+#include "YACSlibEngineExport.hxx"
 #include "RefCounter.hxx"
 #include "Exception.hxx"
 #include "Any.hxx"
@@ -44,27 +64,28 @@ namespace YACS
  * \see TypeCodeStruct
  * \see TypeCodeArray
  */
-    class TypeCode : public RefCounter
+    class YACSLIBENGINE_EXPORT TypeCode : public RefCounter
     {
     public:
       TypeCode(DynType kind);
 
       DynType kind() const;
       const char * getKindRepr() const;
-      
+      const TypeCode *subContentType(int lev) const;
       virtual TypeCode *clone() 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 throw(Exception);
+      virtual const char * name()       const;
       virtual const char * shortName()  const;
-      virtual const char * id()         const throw(Exception);
-      virtual const TypeCode * contentType() const throw(Exception);
-      virtual int isA(const char* repositoryId) const throw(Exception);
+      virtual const char * id()         const;
+      virtual const TypeCode * contentType() const;
+      virtual int isA(const char* repositoryId) const;
       virtual int isA(const TypeCode* tc) const ;
       virtual int isAdaptable(const TypeCode* tc) const;
       virtual int isEquivalent(const TypeCode* tc) const;
       virtual unsigned getSizeInByteOfAnyReprInSeq() const;
+      virtual std::string getPrintStr() const;
 
       static const char *getKindRepr(DynType kind);
       static TypeCode * interfaceTc(const char* id, const char* name);
@@ -76,13 +97,15 @@ namespace YACS
       // --- These operators are placed here to avoid them being used externally
       TypeCode(const TypeCode& tc);
       TypeCode& operator=(const TypeCode& tc);
+#ifndef SWIG
       virtual ~TypeCode();
+#endif
     protected:
       const DynType _kind;
       static const char *KIND_STR_REPR [];
     };
 
-    class TypeCodeComposed : public TypeCode
+    class YACSLIBENGINE_EXPORT TypeCodeComposed : public TypeCode
     {
     protected:
       TypeCodeComposed(const TypeCodeComposed& other);
@@ -99,7 +122,7 @@ namespace YACS
  * \ingroup TypeCodes
  *
  */
-    class TypeCodeObjref : public TypeCodeComposed
+    class YACSLIBENGINE_EXPORT TypeCodeObjref : public TypeCodeComposed
     {
       friend class Visitor;
     public:
@@ -111,15 +134,17 @@ namespace YACS
       void putReprAtPlace(char *pt, const char *val, bool deepCpy) const;
       void destroyZippedAny(char *data) const;
       AnyPtr getOrBuildAnyFromZippedData(char *data) const;
-      const char * id() const   throw(Exception);
-      const char * name() const throw(Exception);
+      const char * id() const;
+      const char * name() const;
       const char * shortName() const;
-      int isA(const char* repositoryId) const throw(Exception);
+      int isA(const char* repositoryId) const;
       virtual int isA(const TypeCode* tc) const ;
       virtual int isAdaptable(const TypeCode* tc) const;
       virtual int isEquivalent(const TypeCode* tc) const;
     protected:
-      ~TypeCodeObjref();
+#ifndef SWIG
+      virtual ~TypeCodeObjref();
+#endif
       TypeCodeObjref(const TypeCodeObjref& other);
     private:
       std::list<TypeCodeObjref *> _listOfBases;
@@ -131,7 +156,7 @@ namespace YACS
  * \ingroup TypeCodes
  *
  */
-    class TypeCodeSeq: public TypeCodeComposed
+    class YACSLIBENGINE_EXPORT TypeCodeSeq: public TypeCodeComposed
     {
     public:
       TypeCodeSeq(const char* repositoryId, const char* name, const TypeCode *content);
@@ -141,16 +166,19 @@ namespace YACS
       void destroyZippedAny(char *data) const;
       virtual unsigned getSizeInByteOfAnyReprInSeq() const;
       AnyPtr getOrBuildAnyFromZippedData(char *data) const;
-      const char * id()   const throw(Exception);
-      const char * name() const throw(Exception);
+      const char * id()   const;
+      const char * name() const;
       const char * shortName() const;
+      virtual std::string getPrintStr() const;
 
-      virtual const TypeCode * contentType() const throw(Exception);
+      virtual const TypeCode * contentType() const;
       virtual int isA(const TypeCode* tc) const ;
       virtual int isAdaptable(const TypeCode* tc) const;
       virtual int isEquivalent(const TypeCode* tc) const;
     protected:
-      ~TypeCodeSeq();
+#ifndef SWIG
+      virtual ~TypeCodeSeq();
+#endif
       TypeCodeSeq(const TypeCodeSeq& tc);
     private:
       const TypeCode  *_content;
@@ -161,7 +189,7 @@ namespace YACS
  * \ingroup TypeCodes
  *
  */
-    class TypeCodeArray : public TypeCodeComposed
+    class YACSLIBENGINE_EXPORT TypeCodeArray : public TypeCodeComposed
     {
     public:
       TypeCodeArray(const char* repositoryId, const char* name, const TypeCode *content, unsigned staticLgth);
@@ -169,18 +197,20 @@ namespace YACS
       void putReprAtPlace(char *pt, const char *val, bool deepCpy) const;
       void destroyZippedAny(char *data) const;
       AnyPtr getOrBuildAnyFromZippedData(char *data) const;
-      const char * id()   const throw(Exception);
-      const char * name() const throw(Exception);
+      const char * id()   const;
+      const char * name() const;
       const char * shortName() const;
       unsigned getStaticLgth() const;
 
-      virtual const TypeCode * contentType() const throw(Exception);
+      virtual const TypeCode * contentType() const;
       virtual int isA(const TypeCode* tc) const ;
       virtual int isAdaptable(const TypeCode* tc) const;
       virtual int isEquivalent(const TypeCode* tc) const;
       unsigned getSizeInByteOfAnyReprInSeq() const;
     protected:
-      ~TypeCodeArray();
+#ifndef SWIG
+      virtual ~TypeCodeArray();
+#endif
       TypeCodeArray(const TypeCodeArray& tc);
     private:
       const TypeCode  *_content;
@@ -194,7 +224,7 @@ namespace YACS
  * \ingroup TypeCodes
  *
  */
-    class TypeCodeStruct : public TypeCodeComposed
+    class YACSLIBENGINE_EXPORT TypeCodeStruct : public TypeCodeComposed
     {
       friend class StructAny;//Access to _members attribute.
     public:
@@ -203,12 +233,12 @@ namespace YACS
       void putReprAtPlace(char *pt, const char *val, bool deepCpy) const;
       void destroyZippedAny(char *data) const;
       AnyPtr getOrBuildAnyFromZippedData(char *data) const;
-      const char * id() const   throw(Exception);
-      const char * name() const throw(Exception);
+      const char * id() const;
+      const char * name() const;
       const char * shortName() const;
       virtual unsigned getSizeInByteOfAnyReprInSeq() const;
-      const TypeCode * contentType() const throw(Exception);
-      virtual int isA(const char* repositoryId) const throw(Exception);
+      const TypeCode * contentType() const;
+      virtual int isA(const char* repositoryId) const;
       virtual int isA(const TypeCode* tc) const ;
       virtual int isAdaptable(const TypeCode* tc) const;
       virtual int isEquivalent(const TypeCode* tc) const;
@@ -219,7 +249,9 @@ namespace YACS
       const char*  memberName(int index) const;
       TypeCode*  memberType(int index) const;
     protected:
-      ~TypeCodeStruct();
+#ifndef SWIG
+      virtual ~TypeCodeStruct();
+#endif
       TypeCodeStruct(const TypeCodeStruct& tc);
     private:
       std::vector< std::pair<std::string,TypeCode*> > _members;