imgtools/romtools/rofsbuild/symbolgenerator.h
author kelvzhu
Mon, 18 Oct 2010 16:16:46 +0800
changeset 655 3f65fd25dfd4
parent 600 6d08f4a05d93
child 662 60be34e1b006
permissions -rw-r--r--
sync up SVN codes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
655
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
     1
/*
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
     3
* All rights reserved.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
     4
* This component and the accompanying materials are made available
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
     6
* which accompanies this distribution, and is available
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
     8
*
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
     9
* Initial Contributors:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
    10
* Nokia Corporation - initial contribution.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
    11
*
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
    12
* Contributors:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
    13
*
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
    14
* Description: 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
    15
*
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
    16
*/
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 600
diff changeset
    17
600
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    18
#ifndef __SYMBOLGENERATOR_H__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    19
#define __SYMBOLGENERATOR_H__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    20
#include <queue>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    21
#include <string>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    22
#include <fstream>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    23
using namespace std;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    24
#include <boost/thread/thread.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    25
#include <boost/thread/condition.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    26
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    27
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    28
struct TPlacedEntry{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    29
    string iFileName;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    30
    bool iExecutable;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    31
    TPlacedEntry(const string& aName, bool aExecutable) {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    32
        iFileName = aName;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    33
        iExecutable = aExecutable;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    34
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    35
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    36
class SymbolGenerator : public boost::thread {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    37
    public:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    38
        static SymbolGenerator* GetInstance();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    39
        static void Release();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    40
        void SetSymbolFileName( const string& fileName );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    41
        void AddFile( const string& fileName, bool isExecutable );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    42
    private:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    43
        SymbolGenerator();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    44
        ~SymbolGenerator();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    45
        void ProcessExecutable( const string& fileName );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    46
        void ProcessDatafile( const string& fileName );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    47
        void ProcessArmv5File( const string& fileName, ifstream& aMap );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    48
        void ProcessGcceOrArm4File( const string& fileName, ifstream& aMap );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    49
        int GetSizeFromBinFile( const string& fileName );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    50
        static void thrd_func();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    51
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    52
        queue<TPlacedEntry> iQueueFiles;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    53
        boost::mutex iMutex;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    54
        static boost::mutex iMutexSingleton;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    55
        static SymbolGenerator* iInst;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    56
        boost::condition_variable iCond;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    57
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    58
        ofstream iSymFile;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    59
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    60
#endif