F´ Flight Software - C/C++ Documentation  NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FatalHandlerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FatalHandlerComponentAc.cpp
3 // \author Auto-generated
4 // \brief cpp file for FatalHandler component base class
5 //
6 // \copyright
7 // Copyright 2009-2015, by the California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12 
13 #include <stdio.h>
14 #include <FpConfig.hpp>
16 #include <Fw/Types/Assert.hpp>
17 #if FW_ENABLE_TEXT_LOGGING
19 #endif
20 
21 
22 namespace Svc {
23 
24  // ----------------------------------------------------------------------
25  // Getters for numbers of input ports
26  // ----------------------------------------------------------------------
27 
30  {
31  FW_ASSERT(portNum < this->getNum_FatalReceive_InputPorts(),static_cast<AssertArg>(portNum));
32  return &this->m_FatalReceive_InputPort[portNum];
33  }
34 
35  // ----------------------------------------------------------------------
36  // Component construction, initialization, and destruction
37  // ----------------------------------------------------------------------
38 
40 #if FW_OBJECT_NAMES == 1
41  FatalHandlerComponentBase(const char* compName) :
42  Fw::PassiveComponentBase(compName)
43 #else
45  Fw::PassiveComponentBase()
46 #endif
47  {
48 
49 
50 
51 
52  }
53 
55  init(NATIVE_INT_TYPE instance)
56  {
57 
58  // Initialize base class
60 
61  // Connect input port FatalReceive
62  for (
63  NATIVE_INT_TYPE port = 0;
64  port < this->getNum_FatalReceive_InputPorts();
65  port++
66  ) {
67 
68  this->m_FatalReceive_InputPort[port].init();
69  this->m_FatalReceive_InputPort[port].addCallComp(
70  this,
71  m_p_FatalReceive_in
72  );
73  this->m_FatalReceive_InputPort[port].setPortNum(port);
74 
75 #if FW_OBJECT_NAMES == 1
76  char portName[120];
77  (void) snprintf(
78  portName,
79  sizeof(portName),
80  "%s_FatalReceive_InputPort[%d]",
81  this->m_objName,
82  port
83  );
84  this->m_FatalReceive_InputPort[port].setObjName(portName);
85 #endif
86 
87  }
88 
89 
90  }
91 
94 
95  }
96 
97  // ----------------------------------------------------------------------
98  // Invocation functions for output ports
99  // ----------------------------------------------------------------------
100 
101  // ----------------------------------------------------------------------
102  // Getters for numbers of ports
103  // ----------------------------------------------------------------------
104 
105  NATIVE_INT_TYPE FatalHandlerComponentBase ::
106  getNum_FatalReceive_InputPorts(void)
107  {
109  this->m_FatalReceive_InputPort
110  );
111  }
112 
113  // ----------------------------------------------------------------------
114  // Calls for invocations received on typed input ports
115  // ----------------------------------------------------------------------
116 
117  void FatalHandlerComponentBase ::
118  m_p_FatalReceive_in(
119  Fw::PassiveComponentBase* callComp,
120  NATIVE_INT_TYPE portNum,
121  FwEventIdType Id
122  )
123  {
124  FW_ASSERT(callComp);
125  FatalHandlerComponentBase* compPtr =
126  (FatalHandlerComponentBase*) callComp;
127  compPtr->FatalReceive_handlerBase(portNum, Id);
128  }
129 
130  // ----------------------------------------------------------------------
131  // Port handler base-class functions for typed input ports
132  // ----------------------------------------------------------------------
133 
134  void FatalHandlerComponentBase ::
135  FatalReceive_handlerBase(
136  NATIVE_INT_TYPE portNum,
137  FwEventIdType Id
138  )
139  {
140 
141  // Make sure port number is valid
142  FW_ASSERT(portNum < this->getNum_FatalReceive_InputPorts(),static_cast<AssertArg>(portNum));
143 
144  // Down call to pure virtual handler method implemented in Impl class
145  this->FatalReceive_handler(portNum, Id);
146 
147  }
148 
149 } // end namespace Svc
FW_NUM_ARRAY_ELEMENTS
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.hpp:103
FatalHandlerComponentAc.hpp
Svc::FatalHandlerComponentBase
Auto-generated base for FatalHandler component.
Definition: FatalHandlerComponentAc.hpp:29
Assert.hpp
EightyCharString.hpp
Fw::PassiveComponentBase
Definition: PassiveComponentBase.hpp:10
Fw::ObjBase::init
void init(void)
Object initializer.
Definition: ObjBase.cpp:26
Svc::FatalHandlerComponentBase::portNum
PRIVATE NATIVE_INT_TYPE portNum
Definition: FatalHandlerComponentAc.hpp:157
Svc::FatalHandlerComponentBase::Id
PROTECTED FwEventIdType Id
Definition: FatalHandlerComponentAc.hpp:92
Svc::FatalHandlerComponentBase::get_FatalReceive_InputPort
Svc::InputFatalEventPort * get_FatalReceive_InputPort(NATIVE_INT_TYPE portNum)
Definition: FatalHandlerComponentAc.cpp:29
FW_ASSERT
#define FW_ASSERT(...)
Definition: Assert.hpp:9
FpConfig.hpp
ISF configuration file.
Svc
Definition: ActiveLoggerComponentAc.cpp:22
Svc::InputFatalEventPort
Definition: FatalEventPortAc.hpp:27
Svc::FatalHandlerComponentBase::~FatalHandlerComponentBase
virtual ~FatalHandlerComponentBase(void)
Definition: FatalHandlerComponentAc.cpp:93
FwEventIdType
#define FwEventIdType
Type representation for a event id.
Definition: FpConfig.hpp:70
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:29
AssertArg
#define AssertArg
Definition: FpConfig.hpp:51
Fw
Definition: BufferGetPortAc.cpp:6