ArrayArrayArrayArrayArray
Statistics: Posted by Gizzeta — 06 Feb 2010, 13:04
CODE:
#include <string>#include <vector>CODE:
class TYourModule : public TUserModule{ ... std::vector<std::string> m_vectOutCaptions; ...}CODE:
#include <string>#include <sstream>#include <vector>using namespace std;CODE:
void GetParamInfo (void* pModule,int n, TParamInfo* pParamInfo){ // make convenient pointer to the module TYourModule* pYourModule = ((TYourModule*)pModule); // the param name stringstream Stream; Stream << (n + 1); pYourModule ->m_vectOutCaptions.push_back(string("Out ") + Stream.str()); if(n < NUM_OF_OUT) { pParamInfo->ParamType = ptArray; pParamInfo->Caption = (PCHAR)(pYourModule ->m_vectOutCaptions[n].c_str()); pParamInfo->IsInput = false; pParamInfo->IsOutput = true; }}Statistics: Posted by martignasse — 20 Jan 2010, 15:51
CODE:
PCHAR OutNames[NUM_OF_OUT];CODE:
for (int n=0; n < NUM_OF_OUT; n++){ OutNames[n] = new char[STRING_BUFF_SIZE]; sprintf_s( OutNames[n], STRING_BUFF_SIZE, "Out%i", (n +1));}CODE:
void GetParamInfo (void* pModule,int n, TParamInfo* pParamInfo){if(n < NUM_OF_OUT){ pParamInfo->ParamType = ptArray; pParamInfo->Caption = ((YourModule*)pModule)->OutNames[n]; pParamInfo->IsInput = false; pParamInfo->IsOutput = true;}}CODE:
for (int n=0; n < NUM_OF_OUT; n++){ if (OutNames[n] != NULL) { delete[] OutNames[n]; }}Statistics: Posted by martignasse — 20 Jan 2010, 13:25
CODE:
#define NUM_OF_OUT 24CODE:
TEVT*pOut[NUM_OF_OUT];CODE:
void GetParamInfo (void* pModule,int n, TParamInfo* pParamInfo) {if(n < NUM_OF_OUT){pParamInfo->ParamType= ptArray;pParamInfo->Caption= "Out";pParamInfo->IsInput= false;pParamInfo->IsOutput= true;}CODE:
void SetEventAddress (void* pModule, int n, TEVT* pEvent) {TMyModule* pMyModule = ((TMyModule*)pModule);if(n < NUM_OF_OUT){pMyModule->pOut[n] = pEvent;}Statistics: Posted by Gizzeta — 20 Jan 2010, 00:59
Statistics: Posted by Gizzeta — 06 Feb 2010, 13:04
CODE:
#include <string>#include <vector>CODE:
class TYourModule : public TUserModule{ ... std::vector<std::string> m_vectOutCaptions; ...}CODE:
#include <string>#include <sstream>#include <vector>using namespace std;CODE:
void GetParamInfo (void* pModule,int n, TParamInfo* pParamInfo){ // make convenient pointer to the module TYourModule* pYourModule = ((TYourModule*)pModule); // the param name stringstream Stream; Stream << (n + 1); pYourModule ->m_vectOutCaptions.push_back(string("Out ") + Stream.str()); if(n < NUM_OF_OUT) { pParamInfo->ParamType = ptArray; pParamInfo->Caption = (PCHAR)(pYourModule ->m_vectOutCaptions[n].c_str()); pParamInfo->IsInput = false; pParamInfo->IsOutput = true; }}Statistics: Posted by martignasse — 20 Jan 2010, 15:51
CODE:
PCHAR OutNames[NUM_OF_OUT];CODE:
for (int n=0; n < NUM_OF_OUT; n++){ OutNames[n] = new char[STRING_BUFF_SIZE]; sprintf_s( OutNames[n], STRING_BUFF_SIZE, "Out%i", (n +1));}CODE:
void GetParamInfo (void* pModule,int n, TParamInfo* pParamInfo){if(n < NUM_OF_OUT){ pParamInfo->ParamType = ptArray; pParamInfo->Caption = ((YourModule*)pModule)->OutNames[n]; pParamInfo->IsInput = false; pParamInfo->IsOutput = true;}}CODE:
for (int n=0; n < NUM_OF_OUT; n++){ if (OutNames[n] != NULL) { delete[] OutNames[n]; }}Statistics: Posted by martignasse — 20 Jan 2010, 13:25
CODE:
#define NUM_OF_OUT 24CODE:
TEVT*pOut[NUM_OF_OUT];CODE:
void GetParamInfo (void* pModule,int n, TParamInfo* pParamInfo) {if(n < NUM_OF_OUT){pParamInfo->ParamType= ptArray;pParamInfo->Caption= "Out";pParamInfo->IsInput= false;pParamInfo->IsOutput= true;}CODE:
void SetEventAddress (void* pModule, int n, TEVT* pEvent) {TMyModule* pMyModule = ((TMyModule*)pModule);if(n < NUM_OF_OUT){pMyModule->pOut[n] = pEvent;}Statistics: Posted by Gizzeta — 20 Jan 2010, 00:59