imgtools/romtools/rofsbuild/symbolgenerator.h
changeset 600 6d08f4a05d93
child 654 7c11c3d8d025
child 655 3f65fd25dfd4
equal deleted inserted replaced
599:fa7a3cc6effd 600:6d08f4a05d93
       
     1 #ifndef __SYMBOLGENERATOR_H__
       
     2 #define __SYMBOLGENERATOR_H__
       
     3 #include <queue>
       
     4 #include <string>
       
     5 #include <fstream>
       
     6 using namespace std;
       
     7 #include <boost/thread/thread.hpp>
       
     8 #include <boost/thread/condition.hpp>
       
     9 
       
    10 
       
    11 struct TPlacedEntry{
       
    12     string iFileName;
       
    13     bool iExecutable;
       
    14     TPlacedEntry(const string& aName, bool aExecutable) {
       
    15         iFileName = aName;
       
    16         iExecutable = aExecutable;
       
    17     }
       
    18 };
       
    19 class SymbolGenerator : public boost::thread {
       
    20     public:
       
    21         static SymbolGenerator* GetInstance();
       
    22         static void Release();
       
    23         void SetSymbolFileName( const string& fileName );
       
    24         void AddFile( const string& fileName, bool isExecutable );
       
    25     private:
       
    26         SymbolGenerator();
       
    27         ~SymbolGenerator();
       
    28         void ProcessExecutable( const string& fileName );
       
    29         void ProcessDatafile( const string& fileName );
       
    30         void ProcessArmv5File( const string& fileName, ifstream& aMap );
       
    31         void ProcessGcceOrArm4File( const string& fileName, ifstream& aMap );
       
    32         int GetSizeFromBinFile( const string& fileName );
       
    33         static void thrd_func();
       
    34 
       
    35         queue<TPlacedEntry> iQueueFiles;
       
    36         boost::mutex iMutex;
       
    37         static boost::mutex iMutexSingleton;
       
    38         static SymbolGenerator* iInst;
       
    39         boost::condition_variable iCond;
       
    40 
       
    41         ofstream iSymFile;
       
    42 };
       
    43 #endif