00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://torc-isi.svn.sourceforge.net/svnroot/torc-isi/branches/staging/0.9/src/torc/packer/ParsePrimitive.hpp $ 00003 // $Id: ParsePrimitive.hpp 10 2011-10-12 18:40:16Z nsteiner $ 00004 00005 // This program is free software: you can redistribute it and/or modify it under the terms of the 00006 // GNU General Public License as published by the Free Software Foundation, either version 3 of the 00007 // License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00010 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 00011 // the GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along with this program. If 00014 // not, see <http://www.gnu.org/licenses/>. 00015 00016 /// \file 00017 /// \brief Header for primitive parser. 00018 00019 #ifndef TORC_PACKER_PARSEPRIMITIVE_HPP 00020 #define TORC_PACKER_PARSEPRIMITIVE_HPP 00021 00022 #include "torc/packer/PrimitiveSet.hpp" 00023 #include "torc/physical/Factory.hpp" 00024 #include <stdio.h> 00025 #include <stdlib.h> 00026 #include <string.h> 00027 00028 00029 namespace torc { 00030 namespace physical { 00031 00032 00033 /// \brief Pare Primitives. 00034 00035 class ParsePrimitive { 00036 protected: 00037 00038 // Input file 00039 FILE *inFile; 00040 // Input file name 00041 const char *inFileName; 00042 // current line 00043 char *line; 00044 //its allocated size 00045 unsigned lineSize; 00046 //Line number 00047 unsigned lineNumber; 00048 00049 /// \brief Reads the current line 00050 void readCurrentLine(); 00051 00052 /// \brief Print printError. 00053 void printError(const char *format, ...); 00054 00055 public: 00056 ParsePrimitive(){ lineSize = 2048; line = new char[2048];} 00057 00058 /// \brief parse an XDLRC file 00059 PrimitiveSetSharedPtr ParsePrimitiveFile(const char *inFileName); 00060 }; 00061 00062 } // namespace physical 00063 } // namespace torc 00064 00065 #endif // TORC_PACKER_PARSEPRIMITIVE_HPP