Salome HOME
Documentation update
[modules/yacs.git] / src / engine / Any.hxx
index f78a39d482b3f2316ff3c7f191e8da425855a4c3..9dd3b4fe7f38cc8c6b436c34b1e64015791ac457 100644 (file)
@@ -1,6 +1,26 @@
+// Copyright (C) 2006-2015  CEA/DEN, EDF R&D
+//
+// 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 __YACSANY_HXX__
 #define __YACSANY_HXX__
 
+#include "YACSlibEngineExport.hxx"
 #include "RefCounter.hxx"
 #include "Exception.hxx"
 #include "SharedPtr.hxx"
@@ -22,7 +42,7 @@ namespace YACS
     class TypeCodeStruct;
     typedef void (*Deallocator)(void *);
 
-    class StringOnHeap
+    class YACSLIBENGINE_EXPORT StringOnHeap
     {
       friend class Any;
       friend class AtomAny;
@@ -46,7 +66,7 @@ namespace YACS
      * \brief: Interface for management of storage of data formated dynamically in its TypeCode.
      *         Warning virtual inheritance on Any daughter classes NOT supported.
      */
-    class Any : public RefCounter
+    class YACSLIBENGINE_EXPORT Any : public RefCounter
     {
       friend class SeqAlloc;
       friend class ArrayAny;
@@ -65,18 +85,21 @@ namespace YACS
       virtual std::string getStringValue() const throw(Exception) = 0;
       //
     protected:
+#ifndef SWIG
       virtual ~Any();
+#endif
       Any(TypeCode* type);
       Any(const Any& other);
       virtual void putMyReprAtPlace(char *data) const = 0;
-      static AnyPtr buildAnyFromCoarseData(char *data, TypeCode* type); //Factory Method
+      //static AnyPtr buildAnyFromCoarseData(char *data, TypeCode* type); //Factory Method
+      static bool IsNull(char *data);
     protected:
       TypeCode* _type;
     };
 
     typedef SharedPtr<AtomAny> AtomAnyPtr;
 
-    class AtomAny : public Any
+    class YACSLIBENGINE_EXPORT AtomAny : public Any
     {
       friend class TypeCode;
 
@@ -119,7 +142,7 @@ namespace YACS
       ValueContainer _value;
     };
     
-    class SeqAlloc 
+    class YACSLIBENGINE_EXPORT SeqAlloc 
     {
       friend class SequenceAny;
       
@@ -140,9 +163,12 @@ namespace YACS
       void destroy(char *pt, const TypeCode *tc);
       void deallocate(char *pt);
       unsigned int size() const;
+      std::vector<unsigned int> getSetItems() const;
+    public:
+      static const char DFT_CHAR_VAR;
     };
     
-    class ComposedAny : public Any
+    class YACSLIBENGINE_EXPORT ComposedAny : public Any
     {
     public:
       virtual void setEltAtRank(int i, const Any *elem) throw(Exception) = 0;
@@ -161,7 +187,7 @@ namespace YACS
 
     typedef SharedPtr<SequenceAny> SequenceAnyPtr;
     
-    class SequenceAny : public ComposedAny
+    class YACSLIBENGINE_EXPORT SequenceAny : public ComposedAny
     {
       friend class TypeCodeSeq;
     public:
@@ -179,6 +205,8 @@ namespace YACS
       static SequenceAny *New(const TypeCode *typeOfContent, unsigned lgth);
       template<class T>
       static SequenceAny *New(T *val, unsigned int lgth, Deallocator deAlloc);
+      std::vector<unsigned int> getSetItems() const { return _alloc.getSetItems(); }
+      SequenceAny *removeUnsetItemsFromThis() const;
     protected:
       void putMyReprAtPlace(char *data) const;
       static void putReprAtPlace(char *data, const char *src, const TypeCode *type, bool deepCpy);
@@ -205,7 +233,7 @@ namespace YACS
     
     typedef SharedPtr<ArrayAny> ArrayAnyPtr;
 
-    class ArrayAny : public ComposedAny
+    class YACSLIBENGINE_EXPORT ArrayAny : public ComposedAny
     {
       friend class TypeCodeArray;
     public:
@@ -242,7 +270,7 @@ namespace YACS
 
     typedef SharedPtr<StructAny> StructAnyPtr;
 
-    class StructAny : public ComposedAny
+    class YACSLIBENGINE_EXPORT StructAny : public ComposedAny
     {
       friend class TypeCodeStruct;
     public: