Instrument Neutral Distributed Interface INDI  1.9.5
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  {
46  return MySyncPoints;
47  }
48 
53 
57  bool LoadDatabase(const char *DeviceName);
58 
62  bool SaveDatabase(const char *DeviceName);
63 
67  void SetDatabaseReferencePosition(double Latitude, double Longitude);
68 
69  typedef void (*LoadDatabaseCallbackPointer_t)(void *);
70 
74  void SetLoadDatabaseCallback(LoadDatabaseCallbackPointer_t CallbackPointer, void *ThisPointer);
75 
76  private:
77  AlignmentDatabaseType MySyncPoints;
78  IGeographicCoordinates DatabaseReferencePosition;
79  bool DatabaseReferencePositionIsValid;
80  LoadDatabaseCallbackPointer_t LoadDatabaseCallback;
81  void *LoadDatabaseCallbackThisPointer;
82 };
83 
84 } // namespace AlignmentSubsystem
85 } // namespace INDI
INDI::AlignmentSubsystem::InMemoryDatabase::LoadDatabase
bool LoadDatabase(const char *DeviceName)
Load the database from persistent storage.
Definition: InMemoryDatabase.cpp:54
INDI::AlignmentSubsystem::InMemoryDatabase::GetDatabaseReferencePosition
bool GetDatabaseReferencePosition(IGeographicCoordinates &Position)
Get the database reference position.
Definition: InMemoryDatabase.cpp:43
INDI::AlignmentSubsystem::AlignmentDatabaseEntry
Entry in the in memory alignment database.
Definition: Common.h:145
INDI::AlignmentSubsystem::InMemoryDatabase::LoadDatabaseCallbackPointer_t
void(* LoadDatabaseCallbackPointer_t)(void *)
Definition: InMemoryDatabase.h:69
INDI::AlignmentSubsystem::InMemoryDatabase::CheckForDuplicateSyncPoint
bool CheckForDuplicateSyncPoint(const AlignmentDatabaseEntry &CandidateEntry, double Tolerance=0.1) const
Check if a entry already exists in the database.
Definition: InMemoryDatabase.cpp:28
INDI::AlignmentSubsystem::InMemoryDatabase::SaveDatabase
bool SaveDatabase(const char *DeviceName)
Save the database to persistent storage.
Definition: InMemoryDatabase.cpp:163
INDI::AlignmentSubsystem::InMemoryDatabase::SetLoadDatabaseCallback
void SetLoadDatabaseCallback(LoadDatabaseCallbackPointer_t CallbackPointer, void *ThisPointer)
Set the function to be called when the database is loaded or reloaded.
Definition: InMemoryDatabase.cpp:233
INDI::AlignmentSubsystem::InMemoryDatabase
This class provides the driver side API to the in memory alignment database.
Definition: InMemoryDatabase.h:23
INDI::AlignmentSubsystem::InMemoryDatabase::AlignmentDatabaseType
std::vector< AlignmentDatabaseEntry > AlignmentDatabaseType
Definition: InMemoryDatabase.h:32
INDI::IGeographicCoordinates
Definition: libastro.h:64
Common.h
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition: AlignmentSubsystemForClients.cpp:11
INDI::AlignmentSubsystem::InMemoryDatabase::GetAlignmentDatabase
AlignmentDatabaseType & GetAlignmentDatabase()
Get a reference to the in memory database.
Definition: InMemoryDatabase.h:44
INDI::AlignmentSubsystem::InMemoryDatabase::InMemoryDatabase
InMemoryDatabase()
Default constructor.
Definition: InMemoryDatabase.cpp:23
INDI::AlignmentSubsystem::InMemoryDatabase::~InMemoryDatabase
virtual ~InMemoryDatabase()
Virtual destructor.
Definition: InMemoryDatabase.h:30
INDI::AlignmentSubsystem::InMemoryDatabase::SetDatabaseReferencePosition
void SetDatabaseReferencePosition(double Latitude, double Longitude)
Set the database reference position.
Definition: InMemoryDatabase.cpp:226
libastro.h