CARMA C++
PDB_Util.h
1 /*
2  * CARMA Project Database Utilities
3  */
4 
5 #ifndef PDB_UTIL_H
6 #define PDB_UTIL_H
7 
8 #include <carma/observertools/ItemValue.h>
9 #include <vector>
10 #include <string>
11 
12 namespace carma {
13 namespace observertools {
14 
20 struct ProjectId {
21  std::string project;
22  std::string obsblock;
23  std::string subobsblock;
24  unsigned short trial;
25 
26  explicit ProjectId();
27 };
28 
33 ProjectId obsblockIdToProjectId(const std::string &obsblockId);
34 
38 std::string projectIdToObsblockId(const ProjectId &pid);
39 
40 // Create an ItemValue from the name and value parts
41 ItemValue makeItemValue(const std::string &n, const std::string &v);
42 
43 // Convert an ItemValue into a string (name:value)
44 std::string itemValueToString(const ItemValue &iv);
45 
46 // Convert a vector of ItemValue into a comma-separated string
47 std::string itemValueVectorToString(const std::vector<ItemValue> &vec);
48 
49 // Convert an ItemValueSequence into a comma-separated string
50 std::string itemValueSequenceToString(const ItemValueSequence &seq);
51 
52 // Throw an error message about the given ItemValue
53 void itemValueError(const std::string &msg, const ItemValue &iv);
54 
55 // Identifier Helpers
56 bool identifierIsNone(const std::string &identifier);
57 bool identifierIsNoneOrEmpty(const std::string &identifier);
58 
59 // RA and DEC Conversion Methods
60 double raConvert(const std::string &ra);
61 double decConvert(const std::string &dec);
62 
63 // File utilities
64 std::string readFile(const std::string &filename);
65 
66 } // namespace carma::observertools
67 } // namespace carma
68 
69 #endif /* PDB_UTIL_H */
70 
71 /* vim: set ts=8 sts=8 sw=8 noet tw=92: */
Structure containing a project obsblock, subobsblock strings and trial number.
Definition: PDB_Util.h:20
ProjectId obsblockIdToProjectId(const std::string &obsblockId)
sequence< ItemValue > ItemValueSequence
Sequence of an Item name and value pairs.
Definition: ItemValue.idl:26
Item name and its value.
Definition: ItemValue.idl:18
std::string projectIdToObsblockId(const ProjectId &pid)