Tulip  4.6.0
Better Visualization Through Research
library/tulip-core/include/tulip/StringProperty.h
00001 /*
00002  *
00003  * This file is part of Tulip (www.tulip-software.org)
00004  *
00005  * Authors: David Auber and the Tulip development Team
00006  * from LaBRI, University of Bordeaux
00007  *
00008  * Tulip is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation, either version 3
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Tulip is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  *
00018  */
00019 
00020 #ifndef TULIP_STRING_H
00021 #define TULIP_STRING_H
00022 
00023 #include <tulip/PropertyTypes.h>
00024 #include <tulip/AbstractProperty.h>
00025 
00026 namespace tlp {
00027 
00028 class PropertyContext;
00029 
00030 typedef AbstractProperty<tlp::StringType, tlp::StringType> AbstractStringProperty;
00031 
00032 /**
00033  * @ingroup Graph
00034  * @brief A graph property that maps a std::string value to graph elements.
00035  */
00036 class TLP_SCOPE StringProperty:public AbstractStringProperty {
00037 public :
00038   StringProperty (Graph *g, const std::string& n="") :AbstractStringProperty(g, n) {}
00039 
00040   // redefinition of some PropertyInterface methods
00041   PropertyInterface* clonePrototype(Graph *, const std::string&);
00042   static const std::string propertyTypename;
00043   const std::string& getTypename() const {
00044     return propertyTypename;
00045   }
00046   // the value size of a StringVectorProperty is not fixed
00047   virtual unsigned int nodeValueSize() const {
00048     return 0;
00049   }
00050   virtual unsigned int edgeValueSize() const {
00051     return 0;
00052   }
00053   int compare(const node n1,const node n2)const;
00054   int compare(const edge e1,const edge e2)const;
00055 };
00056 
00057 /**
00058  * @ingroup Graph
00059  * @brief A graph property that maps a std::vector<std::string> value to graph elements.
00060  */
00061 class TLP_SCOPE StringVectorProperty:public AbstractVectorProperty<tlp::StringVectorType, tlp::StringType> {
00062 public :
00063   StringVectorProperty(Graph *g, const std::string& n=""):AbstractVectorProperty<StringVectorType, tlp::StringType>(g, n) {}
00064 
00065   // redefinition of some PropertyInterface methods
00066   PropertyInterface* clonePrototype(Graph *, const std::string&);
00067   static const std::string propertyTypename;
00068   const std::string& getTypename() const {
00069     return propertyTypename;
00070   }
00071   // the value size of a StringVectorProperty is not fixed
00072   virtual unsigned int nodeValueSize() const {
00073     return 0;
00074   }
00075   virtual unsigned int edgeValueSize() const {
00076     return 0;
00077   }
00078 };
00079 /*\@}*/
00080 }
00081 #endif
 All Classes Files Functions Variables Enumerations Enumerator Properties