OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
EntityCompressedVector.h
Go to the documentation of this file.
1#pragma once
2#pragma warning(disable : 4251)
3
4#include "EntityBase.h"
5#include "OldTreeIcon.h"
6
7#include <list>
8#include <vector>
9
10class __declspec(dllexport) EntityCompressedVector : public EntityBase
11{
12public:
13 EntityCompressedVector(ot::UID ID, EntityBase *parent, EntityObserver *obs, ModelState *ms, ClassFactoryHandler* factory, const std::string &owner);
14 virtual ~EntityCompressedVector();
15
16 virtual bool getEntityBox(double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax) override;
17
18 virtual void StoreToDataBase(void) override;
19
20 virtual std::string getClassName(void) { return "EntityCompressedVector"; };
21
22 virtual entityType getEntityType(void) override { return DATA; };
23 virtual void removeChild(EntityBase *child) override;
24
25 void setTolerance(double tol);
26 double getTolerance(void);
27
28 void setConstantValue(double value, long long dimension);
29
30 void setValues(const std::vector<double> &values);
31 void getValues(std::vector<double> &values);
32
33 void setValues(const double *values, size_t length);
34 void getValues(double *values, size_t length);
35
36 long long getUncompressedLength(void) { return uncompressedLength; }
37
38 void clearData(void);
39
40 bool multiply(std::vector<double> &values);
41 bool add(std::vector<double> &values);
42
43protected:
44 virtual int getSchemaVersion(void) { return 1; };
45 virtual void AddStorageData(bsoncxx::builder::basic::document &storage);
46 virtual void readSpecificDataFromDataBase(bsoncxx::document::view &doc_view, std::map<ot::UID, EntityBase *> &entityMap) override;
47
48private:
49 void compressData(const double *values, size_t length, bool storeData, long long &compressedDataValuesSize, long long &compressedDataCountSize);
50
51 const size_t maximumDataSize;
52 double tolerance;
53 long long uncompressedLength;
54 std::vector<double> compressedDataValues;
55 std::vector<long long> compressedDataCount;
56 long long valuesSize;
57 long long countSize;
58};
59
60
bsoncxx::types::value value
Definition DocumentManager.h:16
double double double double double double tolerance
Definition GeometryOperations.h:23
unsigned long UID
Unique identifier (32 bit unsigned integer)
Definition CoreTypes.h:27