F´ Flight Software - C/C++ Documentation  NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
TlmChanImpl.cpp
Go to the documentation of this file.
1 
13 #include <cstring>
14 #include <Fw/Types/BasicTypes.hpp>
15 #include <Fw/Types/Assert.hpp>
16 #include <Fw/Com/ComBuffer.hpp>
17 
18 #include <stdio.h>
19 
20 namespace Svc {
21 
23  {
24  // clear data
25  this->m_activeBuffer = 0;
26  // clear slot pointers
27  for (NATIVE_UINT_TYPE entry = 0; entry < TLMCHAN_NUM_TLM_HASH_SLOTS; entry++) {
28  this->m_tlmEntries[0].slots[entry] = 0;
29  this->m_tlmEntries[1].slots[entry] = 0;
30  }
31  // clear buckets
32  for (NATIVE_UINT_TYPE entry = 0; entry < TLMCHAN_HASH_BUCKETS; entry++) {
33  this->m_tlmEntries[0].buckets[entry].used = false;
34  this->m_tlmEntries[0].buckets[entry].updated = false;
35  this->m_tlmEntries[0].buckets[entry].bucketNo = entry;
36  this->m_tlmEntries[0].buckets[entry].next = 0;
37  this->m_tlmEntries[0].buckets[entry].id = 0;
38  this->m_tlmEntries[1].buckets[entry].used = false;
39  this->m_tlmEntries[1].buckets[entry].updated = false;
40  this->m_tlmEntries[1].buckets[entry].bucketNo = entry;
41  this->m_tlmEntries[1].buckets[entry].next = 0;
42  this->m_tlmEntries[1].buckets[entry].id = 0;
43  }
44  // clear free index
45  this->m_tlmEntries[0].free = 0;
46  this->m_tlmEntries[1].free = 0;
47 
48 
49  }
50 
52  }
53 
55  NATIVE_INT_TYPE queueDepth,
56  NATIVE_INT_TYPE instance
57  ) {
58  TlmChanComponentBase::init(queueDepth,instance);
59  }
60 
61  NATIVE_UINT_TYPE TlmChanImpl::doHash(FwChanIdType id) {
62  return (id % TLMCHAN_HASH_MOD_VALUE)%TLMCHAN_NUM_TLM_HASH_SLOTS;
63  }
64 
66  const NATIVE_INT_TYPE portNum,
67  U32 key
68  )
69  {
70  // return key
71  this->pingOut_out(0,key);
72  }
73 
74 
75 }
TlmChanImpl.hpp
Component that stores telemetry channel values.
FwChanIdType
#define FwChanIdType
Type representation for a channel id.
Definition: FpConfig.hpp:66
Svc::TlmChanImpl::tlmEntry::updated
bool updated
set whenever a value has been written. Used to skip if writing out values for downlinking
Definition: TlmChanImpl.hpp:52
Svc::TlmChanImpl::TlmSet::free
NATIVE_INT_TYPE free
next free bucket
Definition: TlmChanImpl.hpp:63
ComBuffer.hpp
Svc::TlmChanImpl::m_activeBuffer
U32 m_activeBuffer
Definition: TlmChanImpl.hpp:66
Svc::TlmChanImpl::TlmSet::slots
TlmEntry * slots[TLMCHAN_NUM_TLM_HASH_SLOTS]
set of hash slots in hash table
Definition: TlmChanImpl.hpp:61
Assert.hpp
Svc::TlmChanImpl::tlmEntry::used
bool used
if entry has been used
Definition: TlmChanImpl.hpp:56
Fw::ObjBase::init
void init(void)
Object initializer.
Definition: ObjBase.cpp:26
Svc::TlmChanImpl::tlmEntry::bucketNo
NATIVE_UINT_TYPE bucketNo
for testing
Definition: TlmChanImpl.hpp:57
NATIVE_UINT_TYPE
unsigned int NATIVE_UINT_TYPE
native unsigned integer type declaration
Definition: BasicTypes.hpp:30
Svc::TlmChanComponentBase
Auto-generated base for TlmChan component.
Definition: TlmChanComponentAc.hpp:36
Svc::TlmChanImpl::tlmEntry::id
FwChanIdType id
telemetry id stored in slot
Definition: TlmChanImpl.hpp:51
Svc::TlmChanImpl::pingIn_handler
void pingIn_handler(const NATIVE_INT_TYPE portNum, U32 key)
Definition: TlmChanImpl.cpp:65
Svc::TlmChanImpl::TlmChanImpl
TlmChanImpl(const char *compName)
Definition: TlmChanImpl.cpp:22
Svc
Definition: ActiveLoggerComponentAc.cpp:22
Svc::TlmChanImpl::tlmEntry::next
tlmEntry * next
pointer to next bucket in table
Definition: TlmChanImpl.hpp:55
Svc::TlmChanImpl::~TlmChanImpl
virtual ~TlmChanImpl()
Definition: TlmChanImpl.cpp:51
BasicTypes.hpp
Declares ISF basic types.
Svc::TlmChanImpl::TlmSet::buckets
TlmEntry buckets[TLMCHAN_HASH_BUCKETS]
set of buckets used in hash table
Definition: TlmChanImpl.hpp:62
Svc::TlmChanImpl::m_tlmEntries
struct Svc::TlmChanImpl::TlmSet m_tlmEntries[2]
Svc::TlmChanComponentBase::pingOut_out
void pingOut_out(NATIVE_INT_TYPE portNum, U32 key)
Definition: TlmChanComponentAc.cpp:380
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:29