Atoms Crowd  7.0.0
Metadata.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <AtomsCore/Globals.h>
11 #include <AtomsCore/Serialiser.h>
12 #include <AtomsCore/Hash.h>
13 #include <sstream>
14 #include <string>
15 #include <vector>
16 
17 namespace AtomsCore
18 {
20 
23  class ATOMSCORE_EXPORT Metadata
24  {
25  public:
26 
28 
32  virtual std::string typeStr() const = 0;
33 
35 
39  virtual unsigned int typeId() const = 0;
40 
43 
45  virtual ~Metadata() = 0;
46 
48 
51  virtual void copy(Metadata*) = 0;
52 
54 
57  virtual AtomsPtr<Metadata> clone() const = 0;
58 
60 
63  virtual size_t memSize() const = 0;
64 
66  /*
67  \return true if the operation was successfull, false otherwise
68  */
69  virtual bool setWithValuesAndWeights(const std::vector<AtomsPtr<Metadata>> &values, const std::vector<double> &weights);
70  virtual bool setWithValuesAndWeights(const std::vector<Metadata *> &values, const std::vector<double> &weights);
71 
73  virtual void hash(MurmurHash3& hasher) const = 0;
74 
76  virtual bool isEqual(Metadata* right, double err = 0.0) const;
77 
79  virtual bool isGreater(Metadata* right) const;
80 
81  virtual bool isLess(Metadata* right) const;
82 
83  virtual bool isArray() const;
84 
85  virtual void* dataPtr() = 0;
86 
87  public:
88 
90  virtual bool serialise(Archive& outArchive) const = 0;
91 
93  virtual bool deserialise(Archive& inArchive) = 0;
94 
96  virtual void toString(std::stringstream& ss) const = 0;
97 
98  private:
99 
101  Metadata(const Metadata&);
102 
104 
107  Metadata& operator=(const Metadata&);
108  };
109 
110 
111 
112 }
Archive class.
Definition: Serialiser.h:29
Base Metadata class.
Definition: Metadata.h:24
virtual bool isEqual(Metadata *right, double err=0.0) const
Equal function.
virtual size_t memSize() const =0
Memory size.
virtual bool serialise(Archive &outArchive) const =0
Serialise.
virtual void toString(std::stringstream &ss) const =0
String conversion.
virtual void hash(MurmurHash3 &hasher) const =0
Hash function.
virtual AtomsPtr< Metadata > clone() const =0
clone object
virtual ~Metadata()=0
Virtual destructor.
virtual bool deserialise(Archive &inArchive)=0
Deserialise.
virtual bool setWithValuesAndWeights(const std::vector< AtomsPtr< Metadata >> &values, const std::vector< double > &weights)
Set with weighted values.
virtual void copy(Metadata *)=0
copy value
virtual std::string typeStr() const =0
Type string.
Metadata()
constructor
virtual unsigned int typeId() const =0
Type id.
Definition: Hash.h:23
AtomsCore namespace.
Definition: Agent.h:344