Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

DC_DummyTelecommandLoader.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // DC_DummyTelecommandLoader.cpp 00005 // 00006 // Version 1.0 00007 // Date 4.12.02 00008 // Author A. Pasetti (P&P Software) 00009 00010 #include "../GeneralInclude/CompilerSwitches.h" 00011 #include "../GeneralInclude/DebugSupport.h" 00012 #include "../GeneralInclude/Constants.h" 00013 #include "../GeneralInclude/ClassId.h" 00014 #include "CC_TelecommandManager.h" 00015 #include "DC_DummyTelecommandLoader.h" 00016 00017 // The constant N_SAMPLE_TC was initially defined in the header file 00018 // as follows: 00019 // static int const N_SAMPLE_TC = 3; 00020 // This however gives an error with some compiler settings and was 00021 // therefore replaced with an initialization performed in the 00022 // constructor 00023 00024 DC_DummyTelecommandLoader::DC_DummyTelecommandLoader(void) { 00025 N_SAMPLE_TC = 3; 00026 pSampleTelecommand = new Telecommand*[N_SAMPLE_TC]; 00027 for (unsigned int i=0; i<N_SAMPLE_TC; i++) 00028 pSampleTelecommand[i] = pNULL; 00029 allocationCounter = 0; 00030 setClassId(ID_DUMMYTELECOMMANDLOADER); 00031 } 00032 00033 void DC_DummyTelecommandLoader::activate(void) { 00034 assert( isObjectConfigured() ); 00035 int i = allocationCounter % N_SAMPLE_TC; 00036 allocationCounter++; 00037 getTelecommandManager()->load(pSampleTelecommand[i]); 00038 } 00039 00040 void DC_DummyTelecommandLoader::release(Telecommand* pTc) { 00041 assert( isObjectConfigured() ); 00042 assert( allocationCounter>0 ); 00043 allocationCounter--; 00044 } 00045 00046 void DC_DummyTelecommandLoader::setSampleTelecommand( 00047 unsigned int i, Telecommand* pSampleTc) { 00048 assert( i<N_SAMPLE_TC ); 00049 pSampleTelecommand[i] = pSampleTc; 00050 } 00051 00052 unsigned int DC_DummyTelecommandLoader::getAllocationCounter(void) { 00053 assert( isObjectConfigured() ); 00054 return allocationCounter; 00055 } 00056 00057 bool DC_DummyTelecommandLoader::isObjectConfigured(void) { 00058 // Check configuration of super object 00059 if ( !TelecommandLoader::isObjectConfigured() ) 00060 return NOT_CONFIGURED; 00061 00062 for (unsigned int i=0; i<N_SAMPLE_TC; i++) 00063 if ( pSampleTelecommand[i] == pNULL ) 00064 return NOT_CONFIGURED; 00065 00066 return CONFIGURED; 00067 }
Copyright 2003 P&P Software GmbH - All Rights Reserved