NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
SetFileEditor.h
Go to the documentation of this file.
1 /*
2  This software is Copyright by the Board of Trustees of Michigan
3  State University (c) Copyright 2017.
4 
5  You may use this software under the terms of the GNU public license
6  (GPL). The terms of this license are described at:
7 
8  http://www.gnu.org/licenses/gpl.txt
9 
10  Authors:
11  Ron Fox
12  Giordano Cerriza
13  NSCL
14  Michigan State University
15  East Lansing, MI 48824-1321
16 */
17 
21 #ifndef SETFILEEDITOR_H
22 #define SETFILEEDITOR_H
23 #include "SetFile.h"
24 
25 #include <vector>
26 #include <string>
27 
28 namespace DDAS {
34  class SetFileEditor {
35  private:
36  std::vector<DDAS::VarMapByName> m_varmaps;
37  std::string m_setfile;
38  uint32_t* m_base; // Mapping address.
39  size_t m_longs; // Number of longs.
40  public:
41  SetFileEditor(const char* setfile);
42  virtual ~SetFileEditor();
43 
44  void setSlotSpeed(unsigned short slot, unsigned short speed);
45 
46  void set(unsigned short slot, const char* what, uint32_t value);
47  void setChanPar(
48  unsigned short slot, const char* what, const uint32_t* values
49  );
50  uint32_t get(unsigned short slot, const char* what);
51  std::vector<uint32_t> getChanPar(
52  unsigned short slot, const char* what
53  );
54  private:
55  void mapFile();
56  unsigned offset(unsigned short slot) const { return slot - 2;}
57  const DDAS::VarDescriptor& mapEntry(
58  unsigned short slot, const char* what
59  );
60 
61  uint32_t* pointer(unsigned short slot, const char* what);
62  uint32_t* arrayPointer(unsigned short slot, const char* what);
63  uint32_t* base(unsigned short slot);
64 
65 
66  void checkErrno(int stat, const char* doing);
67  void checkErrno(void* p, const char* doing);
68  void throwErrno(int e, const char* doing);
69  };
70 
71 }
72 
73 #endif
Definition: SetFile.h:46
void setChanPar(unsigned short slot, const char *what, const uint32_t *values)
Definition: SetFileEditor.cpp:126
std::vector< uint32_t > getChanPar(unsigned short slot, const char *what)
Definition: SetFileEditor.cpp:164
SetFileEditor(const char *setfile)
Definition: SetFileEditor.cpp:50
virtual ~SetFileEditor()
Definition: SetFileEditor.cpp:69
: Define structures and funcions for setfiles.
Definition: SetFileEditor.h:34
Definition: functions.h:26
void set(unsigned short slot, const char *what, uint32_t value)
Definition: SetFileEditor.cpp:109
void setSlotSpeed(unsigned short slot, unsigned short speed)
Definition: SetFileEditor.cpp:92