X-Git-Url: http://git.salome-platform.org/gitweb/?p=tools%2Flibbatch.git;a=blobdiff_plain;f=src%2FCore%2FBatch_Versatile.hxx;h=96b4b6016c9dc6ff941709eba32f152894dd96d4;hp=ee8eb2ab73925ebfb17baa930497db84e4f6ca78;hb=a58d413c34de0d83ba055c56b168ad0657e92a29;hpb=e57570465fd02fd7ea993770d9696ecb16042020 diff --git a/src/Core/Batch_Versatile.hxx b/src/Core/Batch_Versatile.hxx index ee8eb2a..96b4b60 100644 --- a/src/Core/Batch_Versatile.hxx +++ b/src/Core/Batch_Versatile.hxx @@ -22,9 +22,8 @@ /* * Versatile.hxx : * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 + * Author : Ivan DUTKA-MALEN - EDF R&D + * Date : September 2003 * */ @@ -37,7 +36,6 @@ #include #include #include "Batch_GenericType.hxx" -#include "Batch_IntType.hxx" #include "Batch_BoolType.hxx" #include "Batch_CharType.hxx" #include "Batch_LongType.hxx" @@ -48,68 +46,68 @@ namespace Batch { - // Les types autorises - // enum DiscriminatorType { UNDEFINED, BOOL, CHAR, INT, LONG, STRING}; - enum DiscriminatorType { UNDEFINED, LONG, STRING, COUPLE }; + // Authorized types + enum DiscriminatorType { BOOL, LONG, STRING, COUPLE }; class BATCH_EXPORT Versatile : public std::list< GenericType * > { public: - // Constructeur standard et destructeur - Versatile() : _discriminator(UNDEFINED), _maxsize(1), _name("undefined") {} - virtual ~Versatile(); - // Constructeur par recopie + // Constructors + Versatile(DiscriminatorType discriminator, size_type maxsize, std::string name); Versatile(const Versatile & V); - // Constructeur depuis le type de "base" - Versatile(long l) : _discriminator(LONG), _maxsize(1), _name("long") { push_back(new LongType(l)); } - Versatile(const std::string & s) : _discriminator(STRING), _maxsize(1), _name("string") { push_back(new StringType(s)); } - Versatile(const Couple & c) : _discriminator(COUPLE), _maxsize(1), _name("couple") { push_back(new CoupleType(c)); } + // Destructor + virtual ~Versatile(); - // Operateur d'affectation et de concatenation a partir d'un type de "base" + // Affectation and concatenation operators from base types Versatile & operator = (const long l) throw(TypeMismatchException); Versatile & operator = (const std::string & ch) throw(TypeMismatchException); Versatile & operator +=(const std::string & ch) throw(TypeMismatchException,ListIsFullException); Versatile & operator , (const std::string & ch) throw(TypeMismatchException,ListIsFullException); + Versatile & operator = (const char * ch) throw(TypeMismatchException); + Versatile & operator +=(const char * ch) throw(TypeMismatchException,ListIsFullException); + Versatile & operator , (const char * ch) throw(TypeMismatchException,ListIsFullException); Versatile & operator = (const Couple & cp) throw(TypeMismatchException); Versatile & operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException); Versatile & operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException); + Versatile & operator = (const int i) throw(TypeMismatchException); + Versatile & operator = (const bool b) throw(TypeMismatchException); - // Operateur d'affectation entre objets - Versatile & operator = (const Versatile & V) throw(TypeMismatchException); - - // Conversion de type vers un type de "base" + // Type conversion to base types operator long() const throw(TypeMismatchException); operator std::string() const throw(TypeMismatchException); operator Couple() const throw(TypeMismatchException); std::string str() const throw(TypeMismatchException); + operator bool() const throw(TypeMismatchException); + operator int() const throw(TypeMismatchException); - // Operateur pour l'affichage sur un stream + // Display on a stream BATCH_EXPORT friend std::ostream & operator << (std::ostream & os, const Versatile & ); - // Positionnement et recuperation du type de l'element interne - void setType(DiscriminatorType) throw(TypeMismatchException); - DiscriminatorType getType() const; + // Check the type + void checkType(DiscriminatorType t) const throw (TypeMismatchException); - // Positionnement et recuperation du nombre d'elements internes - void setMaxSize(int i); - int getMaxSize() const { return _maxsize; } + // Getter methods + DiscriminatorType getType() const; + size_type getMaxSize() const; + const std::string & getName() const; - // Positionnement et recuperation du nom de l'objet - std::string getName() const; - void setName(const std::string & name); + // Erase all internal elements + void eraseAll(); - // Efface tous les elements internes de l'objet - virtual void eraseAll(); protected: - DiscriminatorType _discriminator; // type de l'element interne - size_type _maxsize; // nombre max d'elements internes - std::string _name; // nom de l'objet (sert pour les exceptions) + DiscriminatorType _discriminator; // Internal element type + size_type _maxsize; // Maximum number of internal elements + std::string _name; // Object name (used for exceptions) private: + // Forbid the use of default constructor and affectation operator + Versatile() {} + void operator= (const Versatile & V) {} + }; }