#include #include #include #include #include #include #include "DWUnits.hh" #include "preXmlManager.hh" #include "preXmlInteger.hh" #include "preXmlAngle.hh" #include "preXmlLength.hh" #include "preXmlNumber.hh" #include "agddSection.hh" #include "agddBox.hh" #include "agddTrd.hh" #include "agddTubs.hh" #include "agddCons.hh" #include "agddCompos.hh" #include "agddUnion.hh" #include "agddSubtraction.hh" #include "agddMPosPhi.hh" #include "agddPosXYZ.hh" #include "agddAGDD.hh" #include "agddNumberString.hh" #include "agddUserGeometry.hh" int main(int argc, char** argv) { // Let's make sure the user gave us an input file and an output file. if (argc != 3) { // Oops! The user made a mistake. cerr << endl; cerr << "Usage: " << argv[0] << " " << endl; cerr << " At the moment, something is added to the end of " << "the you specify." << endl; cerr << " This will be annoying, but will prevent accidents." << endl; cerr << endl; return !0; } // We've got enough arguments. We can proceed. string outputFileName(argv[2]); string inputFileName(argv[1]); // The first thing we need to do is fire up the preXml::Manager // which will be the object that will handle all the communication // between us and the preXml file. preXml::Manager useMy(inputFileName); agdd::UserGeometry::InputStructure inputStructure; inputStructure.preXmlManager=&useMy; // Here we create the user's UserGeometry object agdd::UserGeometry userGeometry(inputStructure); // and here we ask it to define the user's geometry. agdd::UserGeometry::OutputStructure outputStructure = userGeometry.defineUserGeometry(); agdd::Buildable * theBuildable=outputStructure.theBuildable; //#include "Old.SCT.geo.hh" // Finally let's assemble the stuff into an XML document ... cout << "Building the XML itself ... " << flush; theBuildable->buildMe(); // This actually "creates" all the xml stuff. cout << "done." << endl; // ... show it to the user ... cout << "Here is the XML which was created:" << endl; theBuildable->sendMeTo(cout); // ... and save it to a file. const string fullOutFileName(outputFileName+".agd"); cout << "Writing xml file to " << fullOutFileName << " ... " << flush; ofstream oFileStream(fullOutFileName.c_str()); theBuildable->sendMeTo(oFileStream); cout << "done." << endl; return 0; } // end of main()