imgtools/romtools/rofsbuild/symbolgenerator.h
changeset 654 7c11c3d8d025
parent 600 6d08f4a05d93
child 662 60be34e1b006
equal deleted inserted replaced
653:8ee61c1e0c5c 654:7c11c3d8d025
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
     1 #ifndef __SYMBOLGENERATOR_H__
    18 #ifndef __SYMBOLGENERATOR_H__
     2 #define __SYMBOLGENERATOR_H__
    19 #define __SYMBOLGENERATOR_H__
     3 #include <queue>
    20 #include <queue>
     4 #include <string>
    21 #include <string>
     5 #include <fstream>
    22 #include <fstream>
     6 using namespace std;
    23 using namespace std;
     7 #include <boost/thread/thread.hpp>
    24 #include <boost/thread/thread.hpp>
     8 #include <boost/thread/condition.hpp>
    25 #include <boost/thread/condition.hpp>
       
    26 #include "symbolprocessunit.h"
     9 
    27 
    10 
    28 
    11 struct TPlacedEntry{
    29 struct TPlacedEntry{
    12     string iFileName;
    30     string iFileName;
    13     bool iExecutable;
    31     bool iExecutable;
    20     public:
    38     public:
    21         static SymbolGenerator* GetInstance();
    39         static SymbolGenerator* GetInstance();
    22         static void Release();
    40         static void Release();
    23         void SetSymbolFileName( const string& fileName );
    41         void SetSymbolFileName( const string& fileName );
    24         void AddFile( const string& fileName, bool isExecutable );
    42         void AddFile( const string& fileName, bool isExecutable );
       
    43         bool HasFinished()	{ return iFinished; }
       
    44         void SetFinished();
       
    45         bool IsEmpty() { return iQueueFiles.empty(); }
       
    46         void LockOutput() { iOutputMutex.lock(); }
       
    47         void UnlockOutput() { iOutputMutex.unlock(); }
       
    48         TPlacedEntry GetNextPlacedEntry();
       
    49         ofstream& GetOutputFileStream() { return iSymFile; };
    25     private:
    50     private:
    26         SymbolGenerator();
    51         SymbolGenerator();
    27         ~SymbolGenerator();
    52         ~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();
    53         static void thrd_func();
    34 
    54 
    35         queue<TPlacedEntry> iQueueFiles;
    55         queue<TPlacedEntry> iQueueFiles;
    36         boost::mutex iMutex;
    56         boost::mutex iMutex;
       
    57         boost::mutex iOutputMutex;
    37         static boost::mutex iMutexSingleton;
    58         static boost::mutex iMutexSingleton;
    38         static SymbolGenerator* iInst;
    59         static SymbolGenerator* iInst;
    39         boost::condition_variable iCond;
    60         boost::condition_variable iCond;
       
    61         bool iFinished;
    40 
    62 
    41         ofstream iSymFile;
    63         ofstream iSymFile;
    42 };
    64 };
       
    65 class SymbolWorker{
       
    66 public:
       
    67 	SymbolWorker();
       
    68 	~SymbolWorker();
       
    69 	void operator()();
       
    70 private:
       
    71 };
    43 #endif
    72 #endif