#include "bbstdPackage.h"
namespace bbstd
{
-
- BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,ASCII)
- BBTK_USER_BLACK_BOX_IMPLEMENTATION(ASCII,bbtk::AtomicBlackBox);
- void ASCII::Process()
- {
- int asciiValue;
- char strTmp[10];
- std::string result("");
- if (bbGetInputIn()!=""){
-
- if (bbGetInputtype()==0){
- std::string commandstr(bbGetInputIn());
- bool ok=true;
- int pos1=0,pos2;
- pos2 = commandstr.find(" ",pos1);
- std::string ccommand;
- while (ok==true)
- {
- if (pos2==-1)
- {
- ok=false;
- ccommand=commandstr.substr(pos1,commandstr.length()-pos1 );
- } else {
- ccommand=commandstr.substr(pos1,pos2-pos1);
- }
- asciiValue = atoi( ccommand.c_str() );
- sprintf(strTmp,"%c",asciiValue);
- result += strTmp;
-
- pos1=pos2+1;
- pos2 = commandstr.find(" ",pos2+1);
- } // while
- } // if type 0
-
- if (bbGetInputtype()==1){
- int i,size=bbGetInputIn().size();
- for (i=0;i<size;i++){
- asciiValue = (int)bbGetInputIn()[i];
- sprintf(strTmp,"%d",asciiValue);
- result +=strTmp;
- if (i!=size-1) {
- result +=" ";
- } // i!=size-1
- } // for
- } // type 1
- }
- bbSetOutputOut( result );
- }
-
- void ASCII::bbUserConstructor()
- {
- bbSetInputIn("");
- bbSetInputtype(0);
- }
-
- void ASCII::bbUserCopyConstructor()
- {
-
- }
-
- void ASCII::bbUserDestructor()
- {
- }
+
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,ASCII);
+ BBTK_BLACK_BOX_IMPLEMENTATION(ASCII,bbtk::AtomicBlackBox);
+ void ASCII::Process()
+ {
+ int asciiValue;
+ char strTmp[10];
+ std::string result("");
+ if (bbGetInputIn()!=""){
+
+ if (bbGetInputtype()==0){
+ std::string commandstr(bbGetInputIn());
+ bool ok=true;
+ int pos1=0,pos2;
+ pos2 = commandstr.find(" ",pos1);
+ std::string ccommand;
+ while (ok==true)
+ {
+ if (pos2==-1)
+ {
+ ok=false;
+ ccommand=commandstr.substr(pos1,commandstr.length()-pos1 );
+ } else {
+ ccommand=commandstr.substr(pos1,pos2-pos1);
+ }
+ asciiValue = atoi( ccommand.c_str() );
+ sprintf(strTmp,"%c",asciiValue);
+ result += strTmp;
+
+ pos1=pos2+1;
+ pos2 = commandstr.find(" ",pos2+1);
+ } // while
+ } // if type 0
+
+ if (bbGetInputtype()==1){
+ int i,size=bbGetInputIn().size();
+ for (i=0;i<size;i++){
+ asciiValue = (int)bbGetInputIn()[i];
+ sprintf(strTmp,"%d",asciiValue);
+ result +=strTmp;
+ if (i!=size-1) {
+ result +=" ";
+ } // i!=size-1
+ } // for
+ } // type 1
+ }
+ bbSetOutputOut( result );
+ }
+
+ void ASCII::bbUserConstructor()
+ {
+ bbSetInputIn("");
+ bbSetInputtype(0);
+ }
+
+ void ASCII::bbUserCopyConstructor()
+ {
+
+ }
+
+ void ASCII::bbUserDestructor()
+ {
+ }
}
// EO namespace bbstd