130 likes | 160 Views
Learn how to add, compile, edit code in SIDL for efficient application development. Includes tips on compiling projects, committing changes, and building drivers in different languages.
E N D
Developing Applicationswith SIDL ANL SIDL Team MCS Division, ANL April 2003
Basic Strategy • Add new SIDL • Compile SIDL • Edit generated code • Compile project • Commit changes
Adding new SIDL • Only new classes produce implementation files • Interfaces produce only IOR and client files • Interfaces/classes outside the current package must be fully qualified
Example I package Example { interface Greet { void sayHello(); } class HelloWorld implements-all Greet { static void shoutHello(); } }
Compiling SIDL • The default target handles SIDL • There is also a target with ignores dependencies and only compiles SIDL ./make.py ./make.py sidl
Editing Generated Code • Implementation files are in the server • Impl files contain splicer blocks • Bk edit the file you wish to change • Insert code between the markers • Bitkeeper is the default • Other RC systems could be used server-<lang>-<file>/<package>/<class>_impl
Example II #ifndef included_SIDL_Example_HelloWorld_impl #include "SIDL/Example/HelloWorld_impl/HelloWorld_impl.hh“ #endif // DO-NOT-DELETE splicer.begin(SIDL.Example.HelloWorld.sayHello._includes) #include <iostream> // DO-NOT-DELETE splicer.end(SIDL.Example.HelloWorld.sayHello._includes) void SIDL::Example::HelloWorld_impl::sayHello() throw ( ::SIDL::NullIORException) { // DO-NOT-DELETE splicer.begin(SIDL.Example.HelloWorld.sayHello) std::cout << "Hello World" << std::endl; // DO-NOT-DELETE splicer.end(SIDL.Example.HelloWorld.sayHello) }
Compiling the Project • The default target handles compilation • There is also a target that only compiles • SIDL dependencies are also handled • Also builds all dependencies ./make.py compile
Commit the Changes • Changes to Impl files must be committed to Bitkeeper • Use the graphical check-in tool • Then push to the parent bk citool bk push
Adding a Driver • Code driver • Compile and link driver • Run driver
Coding a Driver • Use the bindings for the driver language • Located in client-<lang> • Multiple source files can be used • Multiple languages can also be used • Please reconsider using Fortran
Building the Driver • Python is EASY, just make calls • Additions to the makefile • List of driver source • Location of driver executable • Put driver source in input files • Driver build target ./make.py compilePrograms
Makefile Driver Example def defineSource(self): import build.fileset url = self.project.getUrl() self.filesets[‘programs’] = build.fileset.RootedFileSet(url, [os.path.join(‘bin’, ‘basicTests’)], mustExist = 0) self.filesets[‘basicTestsSource’] = build.fileset.RootedFileSet(url, [os.path.join(‘driver’, ‘cxx’, ‘basicTests.cc’)] tag = ‘cxx executable basicTests’ self.filesets[‘sidl’].children.append(self.fileset[‘basicTestsSource’]) return def setupBuild(self): self.defineSource() self.sidlTemplate.addServer(‘Python’) return