F´ Flight Software - C/C++ Documentation  NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
LinuxTimerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title LinuxTimerComponentAc.cpp
3 // \author Auto-generated
4 // \brief cpp file for LinuxTimer 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  // Typed connectors for output ports
26  // ----------------------------------------------------------------------
27 
30  NATIVE_INT_TYPE portNum,
32  )
33  {
34  FW_ASSERT(portNum < this->getNum_CycleOut_OutputPorts(),static_cast<AssertArg>(portNum));
35  this->m_CycleOut_OutputPort[portNum].addCallPort(port);
36  }
37 
38  // ----------------------------------------------------------------------
39  // Serialization connectors for output ports
40  // ----------------------------------------------------------------------
41 
42 #if FW_PORT_SERIALIZATION
43 
46  NATIVE_INT_TYPE portNum,
47  Fw::InputSerializePort *port
48  )
49  {
50  FW_ASSERT(portNum < this->getNum_CycleOut_OutputPorts(),static_cast<AssertArg>(portNum));
51  return this->m_CycleOut_OutputPort[portNum].registerSerialPort(port);
52  }
53 
54 #endif
55 
56  // ----------------------------------------------------------------------
57  // Component construction, initialization, and destruction
58  // ----------------------------------------------------------------------
59 
60  LinuxTimerComponentBase ::
61 #if FW_OBJECT_NAMES == 1
62  LinuxTimerComponentBase(const char* compName) :
63  Fw::PassiveComponentBase(compName)
64 #else
65  LinuxTimerComponentBase() :
66  Fw::PassiveComponentBase()
67 #endif
68  {
69 
70 
71 
72 
73  }
74 
76  init(NATIVE_INT_TYPE instance)
77  {
78 
79  // Initialize base class
81 
82  // Initialize output port CycleOut
83  for (
84  NATIVE_INT_TYPE port = 0;
85  port < this->getNum_CycleOut_OutputPorts();
86  port++
87  ) {
88  this->m_CycleOut_OutputPort[port].init();
89 
90 #if FW_OBJECT_NAMES == 1
91  char portName[120];
92  (void) snprintf(
93  portName,
94  sizeof(portName),
95  "%s_CycleOut_OutputPort[%d]",
96  this->m_objName,
97  port
98  );
99  this->m_CycleOut_OutputPort[port].setObjName(portName);
100 #endif
101 
102  }
103 
104 
105  }
106 
109 
110  }
111 
112  // ----------------------------------------------------------------------
113  // Invocation functions for output ports
114  // ----------------------------------------------------------------------
115 
116  void LinuxTimerComponentBase ::
117  CycleOut_out(
118  NATIVE_INT_TYPE portNum,
119  Svc::TimerVal &cycleStart
120  )
121  {
122  FW_ASSERT(portNum < this->getNum_CycleOut_OutputPorts(),static_cast<AssertArg>(portNum));
123  this->m_CycleOut_OutputPort[portNum].invoke(cycleStart);
124  }
125 
126  // ----------------------------------------------------------------------
127  // Getters for numbers of ports
128  // ----------------------------------------------------------------------
129 
130  NATIVE_INT_TYPE LinuxTimerComponentBase ::
131  getNum_CycleOut_OutputPorts(void)
132  {
134  this->m_CycleOut_OutputPort
135  );
136  }
137 
138  // ----------------------------------------------------------------------
139  // Port connection status queries
140  // ----------------------------------------------------------------------
141 
142  bool LinuxTimerComponentBase ::
143  isConnected_CycleOut_OutputPort(NATIVE_INT_TYPE portNum)
144  {
145  FW_ASSERT(
146  portNum < this->getNum_CycleOut_OutputPorts(),
147  static_cast<AssertArg>(portNum)
148  );
149  return this->m_CycleOut_OutputPort[portNum].isConnected();
150  }
151 
152 } // end namespace Svc
Svc::LinuxTimerComponentBase::~LinuxTimerComponentBase
virtual ~LinuxTimerComponentBase(void)
Definition: LinuxTimerComponentAc.cpp:108
FW_NUM_ARRAY_ELEMENTS
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.hpp:103
LinuxTimerComponentAc.hpp
Assert.hpp
Svc::InputCyclePort
Definition: CyclePortAc.hpp:28
EightyCharString.hpp
Svc::TimerVal
Serializable class for carrying timer values.
Definition: TimerVal.hpp:22
Fw::ObjBase::init
void init(void)
Object initializer.
Definition: ObjBase.cpp:26
Svc::LinuxTimerComponentBase::set_CycleOut_OutputPort
void set_CycleOut_OutputPort(NATIVE_INT_TYPE portNum, Svc::InputCyclePort *port)
Definition: LinuxTimerComponentAc.cpp:29
Svc::LinuxTimerComponentBase::cycleStart
PROTECTED Svc::TimerVal & cycleStart
Definition: LinuxTimerComponentAc.hpp:109
FW_ASSERT
#define FW_ASSERT(...)
Definition: Assert.hpp:9
FpConfig.hpp
ISF configuration file.
Svc
Definition: ActiveLoggerComponentAc.cpp:22
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