imgtools/romtools/rofsbuild/symbolgenerator.h
author Jon Chatten
Mon, 13 Sep 2010 14:04:04 +0100
changeset 641 8dd670a9f34f
parent 600 6d08f4a05d93
child 654 7c11c3d8d025
child 655 3f65fd25dfd4
permissions -rw-r--r--
sbs version 2.15.2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
600
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     1
#ifndef __SYMBOLGENERATOR_H__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     2
#define __SYMBOLGENERATOR_H__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     3
#include <queue>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     4
#include <string>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     5
#include <fstream>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     6
using namespace std;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     7
#include <boost/thread/thread.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     8
#include <boost/thread/condition.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     9
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    10
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    11
struct TPlacedEntry{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    12
    string iFileName;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    13
    bool iExecutable;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    14
    TPlacedEntry(const string& aName, bool aExecutable) {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    15
        iFileName = aName;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    16
        iExecutable = aExecutable;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    17
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    18
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    19
class SymbolGenerator : public boost::thread {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    20
    public:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    21
        static SymbolGenerator* GetInstance();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    22
        static void Release();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    23
        void SetSymbolFileName( const string& fileName );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    24
        void AddFile( const string& fileName, bool isExecutable );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    25
    private:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    26
        SymbolGenerator();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    27
        ~SymbolGenerator();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    28
        void ProcessExecutable( const string& fileName );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    29
        void ProcessDatafile( const string& fileName );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    30
        void ProcessArmv5File( const string& fileName, ifstream& aMap );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    31
        void ProcessGcceOrArm4File( const string& fileName, ifstream& aMap );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    32
        int GetSizeFromBinFile( const string& fileName );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    33
        static void thrd_func();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    34
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    35
        queue<TPlacedEntry> iQueueFiles;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    36
        boost::mutex iMutex;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    37
        static boost::mutex iMutexSingleton;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    38
        static SymbolGenerator* iInst;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    39
        boost::condition_variable iCond;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    40
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    41
        ofstream iSymFile;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    42
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    43
#endif