Salome HOME
Issue #1860: fix end lines with spaces
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_FeatureStore.h
1 // Copyright (C) 2016-20xx CEA/DEN, EDF R&D -->
2
3 // File:        ModelHighAPI_FeatureStore.h
4 // Created:     12 August 2016
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef ModelHighAPI_FeatureStore_H_
8 #define ModelHighAPI_FeatureStore_H_
9
10 #include "ModelHighAPI.h"
11
12 #include <map>
13 #include <list>
14 #include <string>
15 #include <memory>
16
17 class ModelAPI_Feature;
18 class ModelAPI_Data;
19 class GeomAPI_Shape;
20 class ModelAPI_Attribute;
21
22 typedef std::shared_ptr<ModelAPI_Feature>  FeaturePtr;
23 typedef std::shared_ptr<ModelAPI_Attribute>  AttributePtr;
24
25 /**\class ModelHighAPI_FeatureStore
26  * \ingroup CPPHighAPI
27  * \brief Allows to compare the original and the dumped/executed feature
28  */
29 class ModelHighAPI_FeatureStore {
30   /// dumps of attributes of the stored feature (id -> dump)
31   std::map<std::string, std::string> myAttrs;
32    /// dumps of attributes of results (list of results id -> dumps)
33   std::list<std::map<std::string, std::string> > myRes;
34 public:
35   // unused constructor for the map container needs
36   ModelHighAPI_FeatureStore() {}
37   // constructor that initializes this object by feature to store
38   ModelHighAPI_FeatureStore(FeaturePtr theFeature);
39   // compares the stored feature information with the given feature
40   std::string compare(FeaturePtr theFeature);
41
42 private:
43   /// stores the information about all attributes of data in map
44   void storeData(std::shared_ptr<ModelAPI_Data> theData,
45                  std::map<std::string, std::string>& theAttrs);
46   /// compares the information about all attributes of data with map
47   /// returns not empty string with error if something is different
48   std::string compareData(std::shared_ptr<ModelAPI_Data> theData,
49                  std::map<std::string, std::string>& theAttrs);
50   /// dumps the attribute content to the string
51   std::string dumpAttr(const AttributePtr& theAttr);
52   /// dumps the shape main charatceristics to string
53   std::string dumpShape(std::shared_ptr<GeomAPI_Shape>& theShape);
54 };
55
56 #endif