+#include "bbstdASCII.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+ 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(bbtk::BlackBox::Pointer)
+ {
+ }
+
+ void ASCII::bbUserDestructor()
+ {
+ }