AJA NTV2 SDK  17.1.1.1245
NTV2 SDK 17.1.1.1245
ntv2routingexpert.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #ifndef NTV2ROUTINGEXPERT_H
9 #define NTV2ROUTINGEXPERT_H
10 
11 #include "ntv2signalrouter.h"
12 
13 #include "ajabase/system/lock.h"
15 
18 
20 {
21  public:
22  friend class CNTV2SignalRouter;
23 
24  static RoutingExpertPtr GetInstance(const bool inCreateIfNecessary = true);
25  static bool DisposeInstance(void);
26  static uint32_t NumInstances(void);
27 
28  private:
29  RoutingExpert();
30  public:
32 
33  protected:
34  std::string InputXptToString (const NTV2InputXptID inInputXpt) const;
35  std::string OutputXptToString (const NTV2OutputXptID inOutputXpt) const;
36  NTV2InputXptID StringToInputXpt (const std::string & inStr) const;
37  NTV2OutputXptID StringToOutputXpt (const std::string & inStr) const;
38  NTV2WidgetType WidgetIDToType (const NTV2WidgetID inWidgetID);
39  NTV2Channel WidgetIDToChannel(const NTV2WidgetID inWidgetID);
40  NTV2WidgetID WidgetIDFromTypeAndChannel(const NTV2WidgetType inWidgetType, const NTV2Channel inChannel);
41  bool GetWidgetsForOutput (const NTV2OutputXptID inOutputXpt, NTV2WidgetIDSet & outWidgetIDs) const;
42  bool GetWidgetsForInput (const NTV2InputXptID inInputXpt, NTV2WidgetIDSet & outWidgetIDs) const;
43  bool GetWidgetInputs (const NTV2WidgetID inWidgetID, NTV2InputXptIDSet & outInputs) const;
44  bool GetWidgetOutputs (const NTV2WidgetID inWidgetID, NTV2OutputXptIDSet & outOutputs) const;
45  bool IsOutputXptValid (const NTV2OutputXptID inOutputXpt) const;
46  bool IsRGBOnlyInputXpt (const NTV2InputXptID inInputXpt) const;
47  bool IsYUVOnlyInputXpt (const NTV2InputXptID inInputXpt) const;
48  bool IsKeyInputXpt (const NTV2InputXptID inInputXpt) const;
49  bool IsSDIWidget(const NTV2WidgetType inWidgetType) const;
50  bool IsSDIInWidget(const NTV2WidgetType inWidgetType) const;
51  bool IsSDIOutWidget(const NTV2WidgetType inWidgetType) const;
52  bool Is3GSDIWidget(const NTV2WidgetType inWidgetType) const;
53  bool Is12GSDIWidget(const NTV2WidgetType inWidgetType) const;
54  bool IsDualLinkWidget(const NTV2WidgetType inWidgetType) const;
55  bool IsDualLinkInWidget(const NTV2WidgetType inWidgetType) const;
56  bool IsDualLinkOutWidget(const NTV2WidgetType inWidgetType) const;
57  bool IsHDMIWidget(const NTV2WidgetType inWidgetType) const;
58  bool IsHDMIInWidget(const NTV2WidgetType inWidgetType) const;
59  bool IsHDMIOutWidget(const NTV2WidgetType inWidgetType) const;
60 
61  protected:
62  typedef std::map <std::string, NTV2InputXptID> String2InputXpt;
63  typedef String2InputXpt::const_iterator String2InputXptConstIter;
64 
65  typedef std::map <NTV2InputXptID, std::string> InputXpt2String;
66  typedef InputXpt2String::const_iterator InputXpt2StringConstIter;
67 
68  typedef std::map <std::string, NTV2OutputXptID> String2OutputXpt;
69  typedef String2OutputXpt::const_iterator String2OutputXptConstIter;
70 
71  typedef std::map <NTV2OutputXptID, std::string> OutputXpt2String;
72  typedef OutputXpt2String::const_iterator OutputXpt2StringConstIter;
73 
74  typedef std::set<NTV2WidgetType> NTV2WidgetTypeSet;
75  typedef NTV2WidgetTypeSet::const_iterator NTV2WidgetTypeSetConstIter;
76 
77  typedef std::pair <NTV2WidgetID, NTV2WidgetType> Widget2TypePair;
78  typedef std::multimap <NTV2WidgetID, NTV2WidgetType> Widget2Types;
79  typedef Widget2Types::const_iterator Widget2TypesConstIter;
80 
81  typedef std::pair <NTV2WidgetID, NTV2Channel> Widget2ChannelPair;
82  typedef std::multimap <NTV2WidgetID, NTV2Channel> Widget2Channels;
83  typedef Widget2Channels::const_iterator Widget2ChannelsConstIter;
84 
85  typedef std::pair <NTV2WidgetID, NTV2InputXptID> Widget2InputXptPair;
86  typedef std::multimap <NTV2WidgetID, NTV2InputXptID> Widget2InputXpts;
87  typedef Widget2InputXpts::const_iterator Widget2InputXptsConstIter;
88 
89  typedef std::pair <NTV2WidgetID, NTV2OutputXptID> Widget2OutputXptPair;
90  typedef std::multimap <NTV2WidgetID, NTV2OutputXptID> Widget2OutputXpts;
91  typedef Widget2OutputXpts::const_iterator Widget2OutputXptsConstIter;
92 
93  typedef std::multimap <NTV2InputXptID, NTV2WidgetID> InputXpt2WidgetIDs;
94  typedef std::pair <NTV2InputXptID, NTV2WidgetID> InputXpt2WidgetIDPair;
95  typedef InputXpt2WidgetIDs::const_iterator InputXpt2WidgetIDsConstIter;
96 
97  typedef std::multimap <NTV2OutputXptID, NTV2WidgetID> OutputXpt2WidgetIDs;
98  typedef std::pair <NTV2OutputXptID, NTV2WidgetID> OutputXpt2WidgetIDPair;
99  typedef OutputXpt2WidgetIDs::const_iterator OutputXpt2WidgetIDsConstIter;
100 
101  private:
102  void InitInputXpt2String(void);
103  void InitOutputXpt2String(void);
104  void InitInputXpt2WidgetIDs(void);
105  void InitOutputXpt2WidgetIDs(void);
106  void InitWidgetIDToChannels(void);
107  void InitWidgetIDToWidgetTypes(void);
108 
109  mutable AJALock gLock;
110  String2InputXpt gString2InputXpt;
111  InputXpt2String gInputXpt2String;
112  InputXpt2WidgetIDs gInputXpt2WidgetIDs;
113  String2OutputXpt gString2OutputXpt;
114  OutputXpt2String gOutputXpt2String;
115  OutputXpt2WidgetIDs gOutputXpt2WidgetIDs;
116  Widget2OutputXpts gWidget2OutputXpts;
117  Widget2InputXpts gWidget2InputXpts;
118  Widget2Channels gWidget2Channels;
119  Widget2Types gWidget2Types;
120  // NTV2InputXptID Helpers
121  NTV2InputXptIDSet gRGBOnlyInputXpts;
122  NTV2InputXptIDSet gYUVOnlyInputXpts;
123  NTV2InputXptIDSet gKeyInputXpts;
124  // NTV2WidgetType Helpers
125  NTV2WidgetTypeSet gSDIWidgetTypes;
126  NTV2WidgetTypeSet gSDI3GWidgetTypes;
127  NTV2WidgetTypeSet gSDI12GWidgetTypes;
128  NTV2WidgetTypeSet gSDIInWidgetTypes;
129  NTV2WidgetTypeSet gSDIOutWidgetTypes;
130  NTV2WidgetTypeSet gDualLinkWidgetTypes;
131  NTV2WidgetTypeSet gDualLinkInWidgetTypes;
132  NTV2WidgetTypeSet gDualLinkOutWidgetTypes;
133  NTV2WidgetTypeSet gHDMIWidgetTypes;
134  NTV2WidgetTypeSet gHDMIInWidgetTypes;
135  NTV2WidgetTypeSet gHDMIOutWidgetTypes;
136  NTV2WidgetTypeSet gAnalogWidgetTypes;
137 
138 }; // RoutingExpert
139 
140 static RoutingExpertPtr gpRoutingExpert; // RoutingExpert singleton
141 static AJALock gRoutingExpertLock; // Singleton guard mutex
142 
143 #endif
RoutingExpert::IsYUVOnlyInputXpt
bool IsYUVOnlyInputXpt(const NTV2InputXptID inInputXpt) const
Definition: ntv2routingexpert.cpp:213
gpRoutingExpert
static RoutingExpertPtr gpRoutingExpert
Definition: ntv2routingexpert.h:140
RoutingExpert::WidgetIDFromTypeAndChannel
NTV2WidgetID WidgetIDFromTypeAndChannel(const NTV2WidgetType inWidgetType, const NTV2Channel inChannel)
Definition: ntv2routingexpert.cpp:134
RoutingExpert::InputXpt2WidgetIDsConstIter
InputXpt2WidgetIDs::const_iterator InputXpt2WidgetIDsConstIter
Definition: ntv2routingexpert.h:95
RoutingExpert::Is3GSDIWidget
bool Is3GSDIWidget(const NTV2WidgetType inWidgetType) const
Definition: ntv2routingexpert.cpp:248
RoutingExpert::String2InputXpt
std::map< std::string, NTV2InputXptID > String2InputXpt
Definition: ntv2routingexpert.h:62
RoutingExpert::OutputXpt2StringConstIter
OutputXpt2String::const_iterator OutputXpt2StringConstIter
Definition: ntv2routingexpert.h:72
NTV2InputXptIDSet
std::set< NTV2InputXptID > NTV2InputXptIDSet
A collection of distinct NTV2InputXptID values.
Definition: ntv2signalrouter.h:26
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Definition: ntv2enums.h:1305
AJARefPtr
I am a reference-counted pointer template class. I am intended to be a proxy for an underlying object...
Definition: ajarefptr.h:89
RoutingExpert::OutputXpt2WidgetIDsConstIter
OutputXpt2WidgetIDs::const_iterator OutputXpt2WidgetIDsConstIter
Definition: ntv2routingexpert.h:99
NTV2WidgetType
NTV2WidgetType
Definition: ntv2enums.h:2973
RoutingExpert::Widget2ChannelPair
std::pair< NTV2WidgetID, NTV2Channel > Widget2ChannelPair
Definition: ntv2routingexpert.h:81
RoutingExpertPtr
AJARefPtr< RoutingExpert > RoutingExpertPtr
Definition: ntv2routingexpert.h:16
RoutingExpert::String2OutputXpt
std::map< std::string, NTV2OutputXptID > String2OutputXpt
Definition: ntv2routingexpert.h:68
RoutingExpert::InputXpt2StringConstIter
InputXpt2String::const_iterator InputXpt2StringConstIter
Definition: ntv2routingexpert.h:66
RoutingExpert::Widget2OutputXptsConstIter
Widget2OutputXpts::const_iterator Widget2OutputXptsConstIter
Definition: ntv2routingexpert.h:91
RoutingExpert::StringToOutputXpt
NTV2OutputXptID StringToOutputXpt(const std::string &inStr) const
Definition: ntv2routingexpert.cpp:102
RoutingExpert::NumInstances
static uint32_t NumInstances(void)
Definition: ntv2routingexpert.cpp:46
RoutingExpert::NTV2WidgetTypeSetConstIter
NTV2WidgetTypeSet::const_iterator NTV2WidgetTypeSetConstIter
Definition: ntv2routingexpert.h:75
RoutingExpert::GetWidgetsForOutput
bool GetWidgetsForOutput(const NTV2OutputXptID inOutputXpt, NTV2WidgetIDSet &outWidgetIDs) const
Definition: ntv2routingexpert.cpp:145
NTV2InputXptID
enum NTV2InputCrosspointID NTV2InputXptID
RoutingExpert::DisposeInstance
static bool DisposeInstance(void)
Definition: ntv2routingexpert.cpp:37
ntv2signalrouter.h
Declares CNTV2SignalRouter class.
RoutingExpert::Widget2OutputXpts
std::multimap< NTV2WidgetID, NTV2OutputXptID > Widget2OutputXpts
Definition: ntv2routingexpert.h:90
RoutingExpert::IsKeyInputXpt
bool IsKeyInputXpt(const NTV2InputXptID inInputXpt) const
Definition: ntv2routingexpert.cpp:220
RoutingExpert::IsOutputXptValid
bool IsOutputXptValid(const NTV2OutputXptID inOutputXpt) const
Definition: ntv2routingexpert.cpp:199
lock.h
Declares the AJALock class.
RoutingExpert::IsSDIOutWidget
bool IsSDIOutWidget(const NTV2WidgetType inWidgetType) const
Definition: ntv2routingexpert.cpp:241
RoutingExpert::Widget2InputXptPair
std::pair< NTV2WidgetID, NTV2InputXptID > Widget2InputXptPair
Definition: ntv2routingexpert.h:85
RoutingExpert::Widget2TypesConstIter
Widget2Types::const_iterator Widget2TypesConstIter
Definition: ntv2routingexpert.h:79
RoutingExpert::Widget2TypePair
std::pair< NTV2WidgetID, NTV2WidgetType > Widget2TypePair
Definition: ntv2routingexpert.h:77
RoutingExpert::IsRGBOnlyInputXpt
bool IsRGBOnlyInputXpt(const NTV2InputXptID inInputXpt) const
Definition: ntv2routingexpert.cpp:206
RoutingExpert::InputXpt2WidgetIDs
std::multimap< NTV2InputXptID, NTV2WidgetID > InputXpt2WidgetIDs
Definition: ntv2routingexpert.h:93
RoutingExpert::IsHDMIWidget
bool IsHDMIWidget(const NTV2WidgetType inWidgetType) const
Definition: ntv2routingexpert.cpp:283
RoutingExpert::OutputXpt2WidgetIDPair
std::pair< NTV2OutputXptID, NTV2WidgetID > OutputXpt2WidgetIDPair
Definition: ntv2routingexpert.h:98
RoutingExpert::GetWidgetInputs
bool GetWidgetInputs(const NTV2WidgetID inWidgetID, NTV2InputXptIDSet &outInputs) const
Definition: ntv2routingexpert.cpp:171
RoutingExpert::Is12GSDIWidget
bool Is12GSDIWidget(const NTV2WidgetType inWidgetType) const
Definition: ntv2routingexpert.cpp:255
RoutingExpert
Definition: ntv2routingexpert.h:19
RoutingExpert::OutputXpt2String
std::map< NTV2OutputXptID, std::string > OutputXpt2String
Definition: ntv2routingexpert.h:71
RoutingExpert::Widget2InputXptsConstIter
Widget2InputXpts::const_iterator Widget2InputXptsConstIter
Definition: ntv2routingexpert.h:87
RoutingExpert::IsSDIInWidget
bool IsSDIInWidget(const NTV2WidgetType inWidgetType) const
Definition: ntv2routingexpert.cpp:234
RoutingExpert::InputXpt2WidgetIDPair
std::pair< NTV2InputXptID, NTV2WidgetID > InputXpt2WidgetIDPair
Definition: ntv2routingexpert.h:94
RoutingExpert::~RoutingExpert
~RoutingExpert()
Definition: ntv2routingexpert.cpp:71
NTV2OutputXptIDSet
std::set< NTV2OutputXptID > NTV2OutputXptIDSet
A collection of distinct NTV2OutputXptID values.
Definition: ntv2signalrouter.h:18
RoutingExpert::WidgetIDToType
NTV2WidgetType WidgetIDToType(const NTV2WidgetID inWidgetID)
Definition: ntv2routingexpert.cpp:111
RoutingExpert::OutputXpt2WidgetIDs
std::multimap< NTV2OutputXptID, NTV2WidgetID > OutputXpt2WidgetIDs
Definition: ntv2routingexpert.h:97
NTV2WidgetID
NTV2WidgetID
Definition: ntv2enums.h:2847
RoutingExpert::IsDualLinkWidget
bool IsDualLinkWidget(const NTV2WidgetType inWidgetType) const
Definition: ntv2routingexpert.cpp:262
RoutingExpert::IsHDMIOutWidget
bool IsHDMIOutWidget(const NTV2WidgetType inWidgetType) const
Definition: ntv2routingexpert.cpp:297
CNTV2SignalRouter
This class is a collection of widget input-to-output connections that can be applied all-at-once to a...
Definition: ntv2signalrouter.h:55
RoutingExpert::GetInstance
static RoutingExpertPtr GetInstance(const bool inCreateIfNecessary=true)
Definition: ntv2routingexpert.cpp:29
AJALock
Definition: lock.h:30
RoutingExpert::Widget2ChannelsConstIter
Widget2Channels::const_iterator Widget2ChannelsConstIter
Definition: ntv2routingexpert.h:83
RoutingExpert::String2OutputXptConstIter
String2OutputXpt::const_iterator String2OutputXptConstIter
Definition: ntv2routingexpert.h:69
RoutingExpert::Widget2Types
std::multimap< NTV2WidgetID, NTV2WidgetType > Widget2Types
Definition: ntv2routingexpert.h:78
RoutingExpert::StringToInputXpt
NTV2InputXptID StringToInputXpt(const std::string &inStr) const
Definition: ntv2routingexpert.cpp:93
gRoutingExpertLock
static AJALock gRoutingExpertLock
Definition: ntv2routingexpert.h:141
RoutingExpert::InputXpt2String
std::map< NTV2InputXptID, std::string > InputXpt2String
Definition: ntv2routingexpert.h:65
RoutingExpert::Widget2OutputXptPair
std::pair< NTV2WidgetID, NTV2OutputXptID > Widget2OutputXptPair
Definition: ntv2routingexpert.h:89
RoutingExpert::IsDualLinkInWidget
bool IsDualLinkInWidget(const NTV2WidgetType inWidgetType) const
Definition: ntv2routingexpert.cpp:269
RoutingExpert::String2InputXptConstIter
String2InputXpt::const_iterator String2InputXptConstIter
Definition: ntv2routingexpert.h:63
RoutingExpert::OutputXptToString
std::string OutputXptToString(const NTV2OutputXptID inOutputXpt) const
Definition: ntv2routingexpert.cpp:85
RoutingExpert::IsDualLinkOutWidget
bool IsDualLinkOutWidget(const NTV2WidgetType inWidgetType) const
Definition: ntv2routingexpert.cpp:276
RoutingExpert::GetWidgetsForInput
bool GetWidgetsForInput(const NTV2InputXptID inInputXpt, NTV2WidgetIDSet &outWidgetIDs) const
Definition: ntv2routingexpert.cpp:157
NTV2OutputXptID
enum NTV2OutputCrosspointID NTV2OutputXptID
RoutingExpert::GetWidgetOutputs
bool GetWidgetOutputs(const NTV2WidgetID inWidgetID, NTV2OutputXptIDSet &outOutputs) const
Definition: ntv2routingexpert.cpp:185
RoutingExpert::WidgetIDToChannel
NTV2Channel WidgetIDToChannel(const NTV2WidgetID inWidgetID)
Definition: ntv2routingexpert.cpp:123
ajarefptr.h
Defines the AJARefPtr template class.
RoutingExpert::InputXptToString
std::string InputXptToString(const NTV2InputXptID inInputXpt) const
Definition: ntv2routingexpert.cpp:77
RoutingExpert::NTV2WidgetTypeSet
std::set< NTV2WidgetType > NTV2WidgetTypeSet
Definition: ntv2routingexpert.h:74
RoutingExpert::Widget2Channels
std::multimap< NTV2WidgetID, NTV2Channel > Widget2Channels
Definition: ntv2routingexpert.h:82
NTV2WidgetIDSet
std::set< NTV2WidgetID > NTV2WidgetIDSet
A collection of distinct NTV2WidgetID values.
Definition: ntv2signalrouter.h:32
RoutingExpert::IsHDMIInWidget
bool IsHDMIInWidget(const NTV2WidgetType inWidgetType) const
Definition: ntv2routingexpert.cpp:290
RoutingExpert::IsSDIWidget
bool IsSDIWidget(const NTV2WidgetType inWidgetType) const
Definition: ntv2routingexpert.cpp:227
RoutingExpert::Widget2InputXpts
std::multimap< NTV2WidgetID, NTV2InputXptID > Widget2InputXpts
Definition: ntv2routingexpert.h:86