#include <bbstdASCII.h>
Private Member Functions | |
| BBTK_BLACK_BOX_INTERFACE (ASCII, bbtk::AtomicBlackBox) | |
| virtual void | bbUserConstructor () |
| User callback called in the box contructor. | |
| virtual void | bbUserCopyConstructor () |
| User callback called in the box copy constructor. | |
| virtual void | bbUserDestructor () |
| User callback called in the box destructor. | |
| BBTK_DECLARE_INPUT (In, std::string) | |
| BBTK_DECLARE_INPUT (Type, int) | |
| BBTK_DECLARE_OUTPUT (Out, std::string) | |
| BBTK_PROCESS (Process) | |
| void | Process () |
Definition at line 40 of file bbstdASCII.h.
| bbstd::ASCII::BBTK_BLACK_BOX_INTERFACE | ( | ASCII | , | |
| bbtk::AtomicBlackBox | ||||
| ) | [private] |
| void bbstd::ASCII::bbUserConstructor | ( | ) | [private, virtual] |
| void bbstd::ASCII::bbUserCopyConstructor | ( | ) | [private, virtual] |
| void bbstd::ASCII::bbUserDestructor | ( | ) | [private, virtual] |
| bbstd::ASCII::BBTK_DECLARE_INPUT | ( | In | , | |
| std::string | ||||
| ) | [private] |
| bbstd::ASCII::BBTK_DECLARE_INPUT | ( | Type | , | |
| int | ||||
| ) | [private] |
| bbstd::ASCII::BBTK_DECLARE_OUTPUT | ( | Out | , | |
| std::string | ||||
| ) | [private] |
| bbstd::ASCII::BBTK_PROCESS | ( | Process | ) | [private] |
| void bbstd::ASCII::Process | ( | ) | [private] |
Definition at line 39 of file bbstdASCII.cxx.
00040 { 00041 int asciiValue; 00042 char strTmp[10]; 00043 std::string result(""); 00044 if (bbGetInputIn()!=""){ 00045 00046 if (bbGetInputType()==0){ 00047 std::string commandstr(bbGetInputIn()); 00048 bool ok=true; 00049 int pos1=0,pos2; 00050 pos2 = commandstr.find(" ",pos1); 00051 std::string ccommand; 00052 while (ok==true) 00053 { 00054 if (pos2==-1) 00055 { 00056 ok=false; 00057 ccommand=commandstr.substr(pos1,commandstr.length()-pos1 ); 00058 } else { 00059 ccommand=commandstr.substr(pos1,pos2-pos1); 00060 } 00061 asciiValue = atoi( ccommand.c_str() ); 00062 sprintf(strTmp,"%c",asciiValue); 00063 result += strTmp; 00064 00065 pos1=pos2+1; 00066 pos2 = commandstr.find(" ",pos2+1); 00067 } // while 00068 } // if Type 0 00069 00070 if (bbGetInputType()==1){ 00071 int i,size=bbGetInputIn().size(); 00072 for (i=0;i<size;i++){ 00073 asciiValue = (int)bbGetInputIn()[i]; 00074 sprintf(strTmp,"%d",asciiValue); 00075 result +=strTmp; 00076 if (i!=size-1) { 00077 result +=" "; 00078 } // i!=size-1 00079 } // for 00080 } // Type 1 00081 } 00082 bbSetOutputOut( result ); 00083 }
1.5.6