CARMA C++
BFManager.h
1 /*
2  * Subarray Blank/Flag Manager
3  *
4  * This object provides support for generating all blanking/flagging
5  * information for a given subarray. This covers most of the features
6  * of the old fault system.
7  *
8  * Copyright (c) 2010 Ira W. Snyder <iws@ovro.caltech.edu>
9  */
10 
11 #ifndef SUBARRAY_MANAGER_H
12 #define SUBARRAY_MANAGER_H
13 
14 #include <string>
15 #include <list>
16 
19 #include <carma/util/ScopedPthreadMutexLock.h>
20 
21 #include <carma/fault/DagMLNode.h>
22 #include <carma/fault/Evaluators.h>
23 #include <carma/fault/FaultTransport.h>
24 #include <carma/fault/FaultSystemMonitorInfo.h>
25 
26 typedef std::list<std::string> StringList;
27 
28 class BFManager
29 {
30  public:
31  BFManager();
32 
33  /* attach to the top-of-tree DAG node */
34  void attach_dag_node(DagMLNodePtr dagnode);
35 
36  /* attach all monitor points to the Carma Monitor System */
37  void attach_to_monitor_system(carma::monitor::MonitorSystem *inputCms,
39 
40  /* special transients support */
41  void set_noise_source_state(const int saNo, const bool on);
42 
43  /* effect preference support */
44  void set_drive_error_preference(const int saNo, const enum carma::fault::EffectPreference pref);
45  void set_monitor_error_preference(const int saNo, const enum carma::fault::EffectPreference pref);
46  void set_offline_error_preference(const int saNo, const enum carma::fault::EffectPreference pref);
47  void set_phaselock_error_preference(const int saNo, const enum carma::fault::EffectPreference pref);
48 
49  /* perform one mainloop cycle */
50  void perform_cycle(const int frame, FaultTransportWriter &transport);
51 
52  /* get the monitor information from the last iteration */
53  const BFManagerMonitorInfo& getMonitorInfo() const;
54 
55  protected:
56 
57  /* Convert Error Bitmask to External Representation */
58  uint32_t convert_bitmask(DagBFOutputNode *node, const struct BFEvalResult &result);
59 
60  /* Process the status of a single input */
61  void process_input(const int frame, DagMLNodePtr node, FaultTransportWriter &transport);
62 
63  /* Maps of various node types for quick lookups and traversals */
64  DagMLNodeMap gather_map_;
65  DagMLNodeMap monitor_map_;
66  DagMLNodeMap bfoutput_map_;
67 
68  /* Monitor Information */
69  BFManagerMonitorInfo monitor_;
70 
71  /* The original top-of-tree structure */
72  DagMLNodePtr dagnode_;
73 
74  /* blank/flag evaluator */
75  BFEvaluator evaluator_;
76 
77  /* Input Monitor System */
79 
80  /*
81  * Mutex to lock all user-accessible (public) operations
82  *
83  * This has the mutable keyword so that it can still be locked
84  * during methods which are marked const
85  */
86  mutable carma::util::PthreadMutex mutex_;
87 };
88 
89 #endif /* SUBARRAY_MANAGER_H */
90 
91 /* vim: set ts=8 sts=8 sw=8 noet tw=92: */
The monitor system base class.
Semi-hand-forged extensions to the auto-generated classes for the Control subsystem.
Monitor system base class.
Definition: MonitorSystem.h:81
A simple wrapper class that makes use of ::pthread_mutex_t easier in a C++ world. ...
Definition: PthreadMutex.h:41