Instrument Neutral Distributed Interface INDI  2.0.2
InMemoryDatabase.h
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include "Common.h"
12 
13 #include "libastro.h"
14 
15 #include <vector>
16 
17 namespace INDI
18 {
19 namespace AlignmentSubsystem
20 {
24 {
25  public:
28 
30  virtual ~InMemoryDatabase() {}
31 
32  typedef std::vector<AlignmentDatabaseEntry> AlignmentDatabaseType;
33 
34  // Public methods
35 
40  bool CheckForDuplicateSyncPoint(const AlignmentDatabaseEntry &CandidateEntry, double Tolerance = 0.1) const;
41 
45  void RemoveSyncPoint(const AlignmentDatabaseEntry &CandidateEntry, double Tolerance = 0.1);
46 
50  {
51  return MySyncPoints;
52  }
53 
58 
62  bool LoadDatabase(const char *DeviceName);
63 
67  bool SaveDatabase(const char *DeviceName);
68 
72  void SetDatabaseReferencePosition(double Latitude, double Longitude);
73 
74  typedef void (*LoadDatabaseCallbackPointer_t)(void *);
75 
79  void SetLoadDatabaseCallback(LoadDatabaseCallbackPointer_t CallbackPointer, void *ThisPointer);
80 
81  private:
82  AlignmentDatabaseType MySyncPoints;
83  IGeographicCoordinates DatabaseReferencePosition;
84  bool DatabaseReferencePositionIsValid;
85  LoadDatabaseCallbackPointer_t LoadDatabaseCallback;
86  void *LoadDatabaseCallbackThisPointer;
87 };
88 
89 } // namespace AlignmentSubsystem
90 } // namespace INDI
This class provides the driver side API to the in memory alignment database.
AlignmentDatabaseType & GetAlignmentDatabase()
Get a reference to the in memory database.
bool SaveDatabase(const char *DeviceName)
Save the database to persistent storage.
void SetDatabaseReferencePosition(double Latitude, double Longitude)
Set the database reference position.
void SetLoadDatabaseCallback(LoadDatabaseCallbackPointer_t CallbackPointer, void *ThisPointer)
Set the function to be called when the database is loaded or reloaded.
std::vector< AlignmentDatabaseEntry > AlignmentDatabaseType
bool CheckForDuplicateSyncPoint(const AlignmentDatabaseEntry &CandidateEntry, double Tolerance=0.1) const
Check if a entry already exists in the database.
void RemoveSyncPoint(const AlignmentDatabaseEntry &CandidateEntry, double Tolerance=0.1)
Remove a sync point that falls within the tolerance of a candidate point.
bool GetDatabaseReferencePosition(IGeographicCoordinates &Position)
Get the database reference position.
bool LoadDatabase(const char *DeviceName)
Load the database from persistent storage.
virtual ~InMemoryDatabase()
Virtual destructor.
Namespace to encapsulate INDI client, drivers, and mediator classes.
Entry in the in memory alignment database.
Definition: Common.h:152