Changeset 114 for XMLIO_V2/dev/dev_rv
- Timestamp:
- 06/23/10 10:29:45 (14 years ago)
- Location:
- XMLIO_V2/dev/dev_rv/src/XMLIO
- Files:
-
- 2 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/XMLIO/attribut.hpp
r113 r114 90 90 91 91 }; // class Attribut 92 } ;// namespace XMLIOSERVER92 } // namespace XMLIOSERVER 93 93 94 94 #endif //__ATTRIBUT__ -
XMLIO_V2/dev/dev_rv/src/XMLIO/attribut_registrar.hpp
r113 r114 65 65 66 66 }; // class AttributRegistrar 67 } ;// namespace XMLIOSERVER67 } // namespace XMLIOSERVER 68 68 69 69 -
XMLIO_V2/dev/dev_rv/src/XMLIO/axis.hpp
r113 r114 23 23 }; // class CAxis 24 24 25 } ;// namespace XMLIOSERVER25 } // namespace XMLIOSERVER 26 26 27 DECLARE_GROUP(Axis) ;27 DECLARE_GROUP(Axis) 28 28 29 29 #endif // __AXIS__ -
XMLIO_V2/dev/dev_rv/src/XMLIO/base_attribut.hpp
r113 r114 56 56 #endif //__BASE_ATTRIBUT__ 57 57 58 59 60 -
XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.cpp
r112 r114 1 /*using namespace XMLIOSERVER; 1 #include "xmlio.hpp" 2 3 using namespace XMLIOSERVER; 2 4 using namespace XMLIOSERVER::XML; 3 5 using namespace std; 4 6 5 extern "C" 6 { // Début du code C 7 8 typedef void *XMLIOhandle; 9 10 // VIDE TEMPORAIREMENT 11 12 }*/ 7 extern "C" void main_c_(void) ; 13 8 9 void main_c_ (void) 10 { 11 try 12 { 13 string file("/local/XMLIOSERVER_DEV/dev_rv/test/iodef_test.xml"); 14 //string file("/local/XMLIOSERVER_DEV/dev_rv/iodef_test.xml"); 15 16 ifstream istr( file.c_str() , ifstream::in ); 17 18 // On commence la lecture du flux de donnée xml qui doit posséder pour racine un unique noeud nommé "simulation". 19 XMLNode node = XMLNode::CreateNode(istr, Context::GetRootName()); 20 // On parse le fichier xml noeud par noeud (ie on construit dynamiquement notre arbre d'objets). 21 XMLParser::Parse(node); 22 23 // On résoud les héritages descendants ainsi que les héritages par référence. 24 Context::ResolveInheritance(); 25 26 // On écrit l'arborescence résultante du traitement sur la sortie. 27 Context::ShowTree(std::clog); 28 29 } 30 catch(const Exception &exc) 31 { // Pour tout type d'exceptions, on note les informations sur la sortie paramétrée. 32 ERROR(exc.displayText()); 33 // On retourne le code d'erreur en fin d'application pour traitements éventuels. 34 // return (exc.code()); 35 } 36 37 // return (0); 38 } -
XMLIO_V2/dev/dev_rv/src/XMLIO/container.hpp
r113 r114 98 98 }; // class StrHashMap 99 99 100 } ;// namespace XMLIOSERVER100 } // namespace XMLIOSERVER 101 101 102 102 #endif // __XMLIO_CONTAINER__ -
XMLIO_V2/dev/dev_rv/src/XMLIO/context.hpp
r113 r114 16 16 static void ShowTree(ostream& os = std::clog) 17 17 { 18 clog<< NIndent << "<?xml version=\"1.0\"?>" << std::endl;19 clog<< NIndent << "<"<< Context::GetRootName() << ">" << std::endl;18 os << NIndent << "<?xml version=\"1.0\"?>" << std::endl; 19 os << NIndent << "<"<< Context::GetRootName() << ">" << std::endl; 20 20 HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 21 21 for (HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 22 22 // On sort chacun des contextes successivement. 23 { Context::SetCurrentContext((*it).first); clog<< *((*it).second)[(*it).first] << std::endl; }24 clog<< NIndent << "</" << Context::GetRootName() << ">" << std::endl ;23 { Context::SetCurrentContext((*it).first); os << *((*it).second)[(*it).first] << std::endl; } 24 os << NIndent << "</" << Context::GetRootName() << ">" << std::endl ; 25 25 } 26 26 … … 91 91 92 92 if (name.compare(FieldDefinition::GetDefName()) == 0) // Parsing définition des champs. 93 { fieldDef = CreateInstanceAndParse<FieldDefinition>( attributes,_node, FieldDefinition::GetDefName().c_str()); continue; }93 { fieldDef = CreateInstanceAndParse<FieldDefinition>(_node, FieldDefinition::GetDefName().c_str()); continue; } 94 94 95 95 if (name.compare(FileDefinition::GetDefName()) == 0) // Parsing définition des fichiers. 96 { fileDef = CreateInstanceAndParse<FileDefinition >( attributes,_node, FileDefinition ::GetDefName().c_str()); continue; }96 { fileDef = CreateInstanceAndParse<FileDefinition >(_node, FileDefinition ::GetDefName().c_str()); continue; } 97 97 98 98 if (name.compare(AxisDefinition::GetDefName()) == 0) // Parsing pour la définition des axes. 99 { axisDef = CreateInstanceAndParse<AxisDefinition >( attributes, _node, AxisDefinition ::GetDefName().c_str());continue; }99 { axisDef = CreateInstanceAndParse<AxisDefinition >(_node, AxisDefinition ::GetDefName().c_str()); continue; } 100 100 101 101 if (name.compare(GridDefinition::GetDefName()) == 0) // Parsing pour la définition des grilles. 102 { gridDef = CreateInstanceAndParse<GridDefinition >( attributes,_node, GridDefinition ::GetDefName().c_str()); continue; }102 { gridDef = CreateInstanceAndParse<GridDefinition >(_node, GridDefinition ::GetDefName().c_str()); continue; } 103 103 104 104 WARNING("La définition est invalide, seules les champs, grilles, axes et fichiers peuvent être définis !"); … … 125 125 if(gridDef != NULL) out << *(GridDefinition*) gridDef << std::endl; 126 126 } 127 127 128 virtual void resolveDescInheritance(const AttributRegistrar* _parent = 0) 128 129 { 130 if (_parent != 0) return; 129 131 // Résolution des héritages descendants pour chacun des groupes de définitions. 130 132 if(fieldDef != NULL) fieldDef->resolveDescInheritance(); -
XMLIO_V2/dev/dev_rv/src/XMLIO/declare_group.hpp
r112 r114 14 14 }; \ 15 15 typedef child_type##Group child_type##Definition; \ 16 } ;16 } 17 17 18 18 #endif // __DECLARE_GROUP__ -
XMLIO_V2/dev/dev_rv/src/XMLIO/exception.hpp
r112 r114 1 1 #ifndef __XMLIO_EXCEPTION__ 2 #define __XMLIO_EXCEPTION__ 2 #define __XMLIO_EXCEPTION__ 3 3 4 4 // Classes utilisées issues de la STL … … 13 13 { 14 14 public : 15 16 XMLIOException(int _code): Exception(_code) 17 { /* Ne rien faire de plus */ } 18 XMLIOException(const std::string& _msg, int _code): Exception(_msg, _code) 19 { /* Ne rien faire de plus */ } 20 XMLIOException(const std::string& _msg, const std::string& _arg, int _code): Exception(_msg, _arg, _code) 21 { /* Ne rien faire de plus */ } 22 XMLIOException(const std::string& _msg, const Poco::Exception& _exc, int _code): Exception(_msg, _exc, _code) 23 { /* Ne rien faire de plus */ } 24 25 26 XMLIOException(const XMLIOException& _exc): Exception(_exc) 15 16 XMLIOException(int _code): Exception(_code) 27 17 { /* Ne rien faire de plus */ } 28 18 XMLIOException(const std::string& _msg, int _code): Exception(_msg, _code) 19 { /* Ne rien faire de plus */ } 20 XMLIOException(const std::string& _msg, const std::string& _arg, int _code): Exception(_msg, _arg, _code) 21 { /* Ne rien faire de plus */ } 22 XMLIOException(const std::string& _msg, const Poco::Exception& _exc, int _code): Exception(_msg, _exc, _code) 23 { /* Ne rien faire de plus */ } 24 25 26 XMLIOException(const XMLIOException& _exc): Exception(_exc) 27 { /* Ne rien faire de plus */ } 28 29 29 ~XMLIOException() throw() 30 30 { /* Ne rien faire de plus */ } 31 32 XMLIOException& operator = (const XMLIOException& _exc) 33 { Exception::operator = (_exc); return *this; } 34 35 virtual const char* name(void) const throw() { return ("XMLIO>XMLIOException"); } 36 virtual const char* className(void) const throw() { return (typeid(*this).name()); } 37 38 virtual Exception* clone(void) const { return new XMLIOException(*this); } 31 32 XMLIOException& operator = (const XMLIOException& _exc) 33 { Exception::operator = (_exc); return *this; } 34 35 virtual const char* name(void) const throw() { return ("XMLIO>XMLIOException"); } 36 virtual const char* className(void) const throw() { return (typeid(*this).name()); } 37 38 virtual Exception* clone(void) const { return new XMLIOException(*this); } 39 39 virtual void rethrow(void) const { throw *this; } 40 40 41 41 };// class XMLIOException 42 42 43 43 class XMLIOUndefinedValueException : public XMLIOException 44 44 { … … 46 46 XMLIOUndefinedValueException(const std::string& _msg): XMLIOException(_msg, 1001) {} 47 47 const char* name(void) const throw() { return ("XMLIO>UndefinedValueException"); } 48 48 49 49 }; //class XMLIOUndefinedException 50 50 51 51 class XMLIOStreamException : public XMLIOException 52 52 { … … 54 54 XMLIOStreamException(const std::string& _msg): XMLIOException(_msg, 1002) {} 55 55 const char* name(void) const throw() { return ("XMLIO>StreamException"); } 56 56 57 57 }; //class XMLIOStreamException 58 58 59 59 class XMLParsingException : public XMLIOException 60 60 { … … 62 62 XMLParsingException(const std::string& _msg): XMLIOException(_msg, 1003) {} 63 63 const char* name(void) const throw() { return ("XMLIO>XMLParsingException"); } 64 64 65 65 }; //class XMLParsingException 66 66 67 67 class XMLIOIncompatibleTypeException : public XMLIOException 68 68 { … … 70 70 XMLIOIncompatibleTypeException(const std::string& _msg): XMLIOException(_msg, 1003) {} 71 71 const char* name(void) const throw() { return ("XMLIO>XMLIOIncompatibeTypeException"); } 72 72 73 73 }; //class XMLIOIncompatibeTypeException 74 74 75 75 // A compléter. 76 77 };// namespace XMLIOSERVER78 76 79 #endif // __XMLIO_EXCEPTION__ 77 }// namespace XMLIOSERVER 78 79 #endif // __XMLIO_EXCEPTION__ -
XMLIO_V2/dev/dev_rv/src/XMLIO/field.hpp
r113 r114 32 32 }; // class CField 33 33 34 } ;// namespace XMLIOSERVER34 } // namespace XMLIOSERVER 35 35 36 DECLARE_GROUP(Field) ;36 DECLARE_GROUP(Field) 37 37 38 38 #endif // __FIELD__ -
XMLIO_V2/dev/dev_rv/src/XMLIO/file.hpp
r113 r114 32 32 { // Si la définition du fichier intégre des champs et si le fichier est identifié. 33 33 _node.goToParentElement(); 34 vfieldGroup = CreateInstanceAndParse<FieldGroup>( attributes,_node, getId().c_str(), false );34 vfieldGroup = CreateInstanceAndParse<FieldGroup>(_node, getId().c_str(), false ); 35 35 } 36 36 } … … 64 64 }; // class CFile 65 65 66 } ;// namespace XMLIOSERVER66 } // namespace XMLIOSERVER 67 67 68 DECLARE_GROUP(File) ;68 DECLARE_GROUP(File) 69 69 70 70 -
XMLIO_V2/dev/dev_rv/src/XMLIO/grid.hpp
r113 r114 23 23 }; // class CGrid 24 24 25 } ;// namespace XMLIOSERVER25 } // namespace XMLIOSERVER 26 26 27 DECLARE_GROUP(Grid) ;27 DECLARE_GROUP(Grid) 28 28 29 29 #endif // __GRID__ -
XMLIO_V2/dev/dev_rv/src/XMLIO/logger.hpp
r112 r114 35 35 public : 36 36 37 ILogger( const string& _fileLogName, bool _withConsole = true)37 ILogger() 38 38 { 39 39 // Perte mémoire faible ici (/ still reachable: 84 bytes in 2 blocks /) … … 96 96 97 97 // Initialisation de la classe de Logging 98 static ILogger LOGGER ("xmlio.log");98 static ILogger LOGGER; 99 99 100 100 ///////////////////////////////////////////////////////////////////// … … 114 114 ///////////////////////////////////////////////////////////////////// 115 115 116 } ;// namespace XMLIOSERVER116 } // namespace XMLIOSERVER 117 117 118 118 #define ERROR(MSG) (XMLIOSERVER::ILogger::GetConsoleLogger().error(MSG)) -
XMLIO_V2/dev/dev_rv/src/XMLIO/object_template.hpp
r112 r114 45 45 46 46 virtual bool hasChild(void) const { return (false); } 47 virtual void printChild(ostream& out) const { /* Ne rien faire de plus */}47 virtual void printChild(ostream& out) const { out << NIndent << "<!-- No child -->" << std::endl; } 48 48 49 49 virtual void resolveDescInheritance(const AttributRegistrar* _parent = 0) { addAttributes(*_parent); } … … 127 127 } 128 128 129 template <class V> static V* CreateInstanceAndParse( THashAttributes& attributes,XMLNode& _node, const char* defaultId, bool parseAttr = true )129 template <class V> static V* CreateInstanceAndParse(XMLNode& _node, const char* defaultId, bool parseAttr = true ) 130 130 { 131 131 V* instance_ptr = NULL; string did(defaultId); -
XMLIO_V2/dev/dev_rv/src/XMLIO/xml_node.hpp
r113 r114 163 163 };// class XMLNode 164 164 165 };// namespace XML165 } // namespace XML 166 166 167 } ;// namespace XMLIOSERVER167 }// namespace XMLIOSERVER 168 168 169 169 -
XMLIO_V2/dev/dev_rv/src/XMLIO/xml_parser.hpp
r112 r114 43 43 } 44 44 }; // class XMLParser 45 } ;// namespace XML45 } // namespace XML 46 46 47 } ;// namespace XMLIOSERVER47 }// namespace XMLIOSERVER 48 48 49 49
Note: See TracChangeset
for help on using the changeset viewer.