654
|
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 |
|
600
|
18 |
#ifndef __SYMBOLGENERATOR_H__
|
|
19 |
#define __SYMBOLGENERATOR_H__
|
|
20 |
#include <queue>
|
|
21 |
#include <string>
|
|
22 |
#include <fstream>
|
|
23 |
using namespace std;
|
|
24 |
#include <boost/thread/thread.hpp>
|
|
25 |
#include <boost/thread/condition.hpp>
|
654
|
26 |
#include "symbolprocessunit.h"
|
600
|
27 |
|
|
28 |
|
|
29 |
struct TPlacedEntry{
|
|
30 |
string iFileName;
|
|
31 |
bool iExecutable;
|
|
32 |
TPlacedEntry(const string& aName, bool aExecutable) {
|
|
33 |
iFileName = aName;
|
|
34 |
iExecutable = aExecutable;
|
|
35 |
}
|
|
36 |
};
|
|
37 |
class SymbolGenerator : public boost::thread {
|
|
38 |
public:
|
|
39 |
static SymbolGenerator* GetInstance();
|
|
40 |
static void Release();
|
|
41 |
void SetSymbolFileName( const string& fileName );
|
|
42 |
void AddFile( const string& fileName, bool isExecutable );
|
654
|
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; };
|
600
|
50 |
private:
|
|
51 |
SymbolGenerator();
|
|
52 |
~SymbolGenerator();
|
|
53 |
static void thrd_func();
|
|
54 |
|
|
55 |
queue<TPlacedEntry> iQueueFiles;
|
|
56 |
boost::mutex iMutex;
|
654
|
57 |
boost::mutex iOutputMutex;
|
600
|
58 |
static boost::mutex iMutexSingleton;
|
|
59 |
static SymbolGenerator* iInst;
|
|
60 |
boost::condition_variable iCond;
|
654
|
61 |
bool iFinished;
|
600
|
62 |
|
|
63 |
ofstream iSymFile;
|
|
64 |
};
|
654
|
65 |
class SymbolWorker{
|
|
66 |
public:
|
|
67 |
SymbolWorker();
|
|
68 |
~SymbolWorker();
|
|
69 |
void operator()();
|
|
70 |
private:
|
|
71 |
};
|
600
|
72 |
#endif
|