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

CopyControlBlock.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // CopyControlBlock.cpp 00005 // 00006 // Version 1.0 00007 // Date 16.10.03 (Version 1.0) 00008 // Author A. Pasetti (P&P Software), R. Totaro 00009 // 00010 // Change Record: 00011 00012 #include "../GeneralInclude/CompilerSwitches.h" 00013 #include "../GeneralInclude/DebugSupport.h" 00014 #include "../GeneralInclude/BasicTypes.h" 00015 #include "../GeneralInclude/Constants.h" 00016 #include "../Base/CC_RootObject.h" 00017 #include "CopyControlBlock.h" 00018 00019 CopyControlBlock::CopyControlBlock(void) { 00020 u=pNULL; 00021 y=pNULL; 00022 } 00023 00024 void CopyControlBlock::setNumberOfInputs(unsigned int n) { 00025 assert(nInputs<0); 00026 assert(n>0); 00027 00028 nInputs=n; 00029 u=new TD_Float[n]; 00030 for (unsigned int i=0;i<n;i++) 00031 u[i]=(TD_Float)0.0; 00032 } 00033 00034 void CopyControlBlock::setNumberOfOutputs(unsigned int n) { 00035 assert(nOutputs<0); 00036 assert(n>0); 00037 00038 nOutputs=n; 00039 y=new TD_Float[n]; 00040 for (unsigned int i=0;i<n;i++) 00041 y[i]=(TD_Float)0.0; 00042 } 00043 00044 void CopyControlBlock::setInput(unsigned int i,TD_Float newValue) { 00045 assert(u!=pNULL && (int)i<nInputs); 00046 00047 if ((int)i<nInputs) 00048 u[i]=newValue; 00049 else 00050 CC_RootObject::getEventRepository()->create(this,EVT_ILLEGAL_CB); 00051 } 00052 00053 void CopyControlBlock::setOutput(unsigned int i,TD_Float newValue) { 00054 assert(y!=pNULL && (int)i<nInputs); 00055 00056 if ((int)i<nOutputs) 00057 y[i]=newValue; 00058 else 00059 CC_RootObject::getEventRepository()->create(this,EVT_ILLEGAL_CB); 00060 } 00061 00062 TD_Float CopyControlBlock::getInput(unsigned int i) const { 00063 assert(u!=pNULL && (int)i<nInputs); 00064 00065 return u[i]; 00066 } 00067 00068 TD_Float CopyControlBlock::getOutput(unsigned int i) const { 00069 assert(y!=pNULL && (int)i<nOutputs); 00070 00071 return y[i]; 00072 } 00073 00074 void CopyControlBlock::reset(void) { 00075 assert(x!=pNULL && u!=pNULL); 00076 00077 // Reset the state variables 00078 ControlBlock::reset(); 00079 00080 for (int i=0;i<nInputs;i++) 00081 u[i]=(TD_Float)0.0; 00082 } 00083
Copyright 2003 P&P Software GmbH - All Rights Reserved