]> Creatis software - bbtk.git/blob - packages/std/src/bbstdRandomString.cxx
c9d9ac389d99430b5bb4e5e15ffdb73105fbbcfc
[bbtk.git] / packages / std / src / bbstdRandomString.cxx
1 //===== 
2 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
3 //===== 
4 #include "bbstdRandomString.h"
5 #include "bbstdPackage.h"
6 namespace bbstd
7 {
8
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,RandomString)
10 BBTK_BLACK_BOX_IMPLEMENTATION(RandomString,bbtk::AtomicBlackBox);
11 //===== 
12 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
13 //===== 
14
15
16 static const char alphanum[] =
17 "0123456789"
18 //"!@#$%^&*"
19 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
20 "abcdefghijklmnopqrstuvwxyz";
21
22
23 char genRandom()
24 {
25 }
26
27
28 void RandomString::Process()
29 {
30
31 // THE MAIN PROCESSING METHOD BODY
32 //   Here we simply set the input 'In' value to the output 'Out'
33 //   And print out the output value
34 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
35 //    void bbSet{Input|Output}NAME(const TYPE&)
36 //    const TYPE& bbGet{Input|Output}NAME() const 
37 //    Where :
38 //    * NAME is the name of the input/output
39 //      (the one provided in the attribute 'name' of the tag 'input')
40 //    * TYPE is the C++ type of the input/output
41 //      (the one provided in the attribute 'type' of the tag 'input')
42 //    bbSetOutputOut( bbGetInputIn() );
43 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
44
45     int stringLength = sizeof(alphanum) - 1;
46     srand(time(0));
47     std::string STR;
48     for(unsigned int i = 0; i < 8; ++i)
49     {
50             STR += alphanum[rand() % stringLength];
51     }
52          bbSetOutputOut( STR );
53 printf("EED RandomString::Process randomString=%s\n",STR.c_str());
54 }
55
56 //===== 
57 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
58 //===== 
59 void RandomString::bbUserSetDefaultValues()
60 {
61
62 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
63 //    Here we initialize the input 'In' to 0
64 //   bbSetInputIn(0);
65   
66 }
67 //===== 
68 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
69 //===== 
70 void RandomString::bbUserInitializeProcessing()
71 {
72
73 //  THE INITIALIZATION METHOD BODY :
74 //    Here does nothing 
75 //    but this is where you should allocate the internal/output pointers 
76 //    if any 
77
78   
79 }
80 //===== 
81 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
82 //===== 
83 void RandomString::bbUserFinalizeProcessing()
84 {
85
86 //  THE FINALIZATION METHOD BODY :
87 //    Here does nothing 
88 //    but this is where you should desallocate the internal/output pointers 
89 //    if any
90   
91 }
92 }
93 // EO namespace bbstd
94
95