16 #ifndef __TY_ELEMENT__ 17 #define __TY_ELEMENT__ 22 #endif // HAVE_CONFIG_H 26 #endif // _MSC_VER > 1000 28 #pragma warning( disable : 4275 4800 4355 4273 4786 4018 4503 4081) 32 #include <unordered_map> 35 #include <boost/exception/error_info.hpp> 54 #define TYDIRPREFERENCEMANAGER "UserPreferences" 67 #define OPROTODECL(classname) \ 69 virtual OPrototype* clone() const { \ 70 return new classname(); \ 72 virtual const char* getClassName() const { return #classname; } \ 73 static classname* safeDownCast(OPrototype * pObject) { \ 75 classname * pTypedObject = dynamic_cast<classname *>(pObject); \ 76 if (pTypedObject != nullptr) { \ 77 return pTypedObject; \ 87 typedef boost::error_info < struct tag_classname, std::string >
221 static OPrototype* findAndClone(
const char* className);
232 static int findPrototype(
const char* className);
258 bool isA(
const char* className)
const;
281 virtual std::unique_ptr<OPrototype> make() = 0;
298 static_assert(std::is_base_of<OPrototype, T>::value,
299 "Factory<T> : T must inherit from OPrototype");
302 virtual std::unique_ptr<OPrototype>
make () {
return typed_make(); }
324 static std::unordered_map<std::string, IOProtoFactory::ptr_type>
_factory_map;
349 #define TY_EXTENSION_DECL(classname) \ 350 friend class classname; \ 352 virtual TYEditWidget* getEditWidget() { \ 353 return new classname##Widget(this); \ 356 #define TY_EXTENSION_DECL(classname) \ 358 virtual TYEditWidget* getEditWidget() { \ 359 return new classname##Widget(this); \ 363 #define TY_EXTENSION_DECL_ONLY(classname) \ 365 virtual TYEditWidget* getEditWidget() ; 367 #define TY_EXTENSION_INST(classname) \ 368 TYEditWidget* classname::getEditWidget() { \ 369 return new classname##Widget(this); \ 374 #define TY_EXTENSION_DECL(classname) 375 #define TY_EXTENSION_DECL_ONLY(classname) 376 #define TY_EXTENSION_INST(classname) 386 #define TY_EXT_GRAPHIC_DECL(classname) \ 387 friend class classname; \ 389 virtual LPTYElementGraphic getGraphicObject() { \ 390 if (!_pGraphicObject) _pGraphicObject = new classname##Graphic(this); \ 391 return _pGraphicObject; \ 394 #define TY_EXT_GRAPHIC_DECL(classname) \ 396 virtual LPTYElementGraphic getGraphicObject() { \ 397 if (!_pGraphicObject) _pGraphicObject = new classname##Graphic(this); \ 398 return _pGraphicObject; \ 402 #define TY_EXT_GRAPHIC_DECL_ONLY(classname) \ 404 virtual LPTYElementGraphic getGraphicObject(); 406 #define TY_EXT_GRAPHIC_INST(classname) \ 407 LPTYElementGraphic classname::getGraphicObject() { \ 408 if (!_pGraphicObject) _pGraphicObject = new classname##Graphic(this); \ 409 return _pGraphicObject; \ 414 #define TY_EXT_GRAPHIC_DECL(classname) 415 #define TY_EXT_GRAPHIC_DECL_ONLY(classname) 416 #define TY_EXT_GRAPHIC_INST(classname) 429 return T::safeDownCast(elt);
512 virtual void updateCurrentCalcul(
TYListID& listID,
bool recursif =
true);
522 virtual void setInCurrentCalcul(
bool state,
bool recurschild =
true,
bool recursparent =
true);
536 void setCopyCount(
const unsigned int copyCount) { _copyCount = copyCount; }
543 void OnChildInCalculStatusChange();
566 void drawGraphic(
bool draw =
true);
571 virtual void updateGraphic();
576 virtual void updateGraphicTree();
619 void setID(
const QString& str_id);
624 const TYUUID& getID()
const;
642 void setName(std::string
name) { _name = QString::fromStdString(name); }
647 virtual QString
getName()
const {
return _name; }
668 virtual void setIsAcousticModified(
bool isModified);
677 virtual void setIsGeometryModified(
bool isModified);
699 bool operator==(
const TYElement& other)
const;
704 bool operator!=(
const TYElement& other)
const;
718 virtual bool deepCopy(
const TYElement* pOther,
bool copyId =
true,
bool pUseCopyTag =
false);
735 virtual std::string
toString()
const {
return "TYElement"; };
747 bool callFromXMLIfEqual(
DOM_Element& domElement,
int* pRetVal = NULL);
756 std::string getMetierName();
800 static void purgeInstances();
825 static QString toString(
TYUUID& uuid);
831 static uint64 getConstructorCount();
837 static uint64 getDestructorCount();
843 static uint64 getIdGenerationCount();
858 static void setRegenerateID(
const bool& bRegenerate) { _bRegenerateID = bRegenerate; }
931 {
return qstr.toLocal8Bit().data(); }
935 QString msg; QTextStream str(&msg);
944 inline QDebug
_debugXml(
const char* expr,
const QDomNode& node)
945 {
return qDebug() << expr <<
xml2qstring((node)); }
947 #define debugXml(expr) _debugXml(#expr, (expr)) 949 #define debugXml(expr) ((void)0) 952 #endif // __TY_ELEMENT__ static uint64 ty_regen_id_counter
LPTYElementGraphic _pGraphicObject
L'object graphique metier associe a cet element.
static void setLogInstances(bool log)
std::map< TYUUID, TYElement * > TYElementContainer
static bool _toSave
Indicateur de modification. Passe a true si un TYElement a ete modifie, Indique la necessite de sauve...
void setParent(TYElement *pParent)
TYElement * _pParent
Reference sur l'element parent.
void setName(QString name)
T fromString(const std::string &str, std::ios_base &(*f)(std::ios_base &)=std::dec)
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
bool getIsGeometryModified()
std::unique_ptr< T > ptr_type
std::vector< LPTYElement > LPTYElementArray
static bool getRegenerateID()
static TYElementContainer * _instances
Collection de toutes les instances de type TYElement et derivees.
static bool _logInstances
Indique si on souhaite registrer toutes les instances de type TYElement et derivees.
This file provides class for solver configuration.
void TYEditWidget
Declarations de types pour l'API IHM et l'Impression.
bool getIsAcousticModified()
virtual std::string toString() const
virtual bool isInCurrentCalcul()
void setName(std::string name)
static void setRegenerateID(const bool &bRegenerate)
bool _isGeometryModified
Indicateur de modification de la geometrie.
void setCopyCount(const unsigned int copyCount)
Modifie la vaeur du compteur.
const char * str_qt2c(const QString &qstr)
QString xml2qstring(const QDomNode &node)
std::unique_ptr< OPrototype::Factory< T > > build_factory()
void * _allUses
Multi purpose void pointer (use for compatibility actually)
static bool _bRegenerateID
Indicateur de regeneration d'ID true si regeneration d'ID a la lecture d'un fichier XML...
static bool getIsSavedOk()
unsigned long long uint64
void setAllUses(void *allUses)
TYElement * getParent() const
static bool getLogInstances()
#define OPROTODECL(classname)
QString _name
Nom courant de l'element.
boost::error_info< struct tag_classname, std::string > oproto_classname_errinfo
QString getStringID() const
void * LPTYElementGraphic
static std::unordered_map< std::string, IOProtoFactory::ptr_type > _factory_map
virtual const char * getClassName() const
TYUUID _uuid
Identifiant unique de l'element.
virtual std::unique_ptr< OPrototype > make()
static void setIsSavedOk(const bool &toSave)
const char * xml2cstring(const QDomNode &node)
Representation graphique d'un element de base (fichier header)
T * downcast(TYElement *elt)
std::list< TYUUID > TYListID
Collection d'identifiants.
bool _isAcousticModified
Indicateur de modification acoustique.
virtual QString getName() const
void addCopy()
Increment le compteur de nombre de copies.
static uint64 ty_created_counter
QDebug _debugXml(const char *expr, const QDomNode &node)
std::unique_ptr< IOProtoFactory > ptr_type
bool _inCurrentCalcul
Indique si cet element est actif dans le Calcul courant.
static uint64 ty_destroyed_counter