1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2014 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
11 #include <sys/types.h> // for pid_t
13 #include "Types.h" // for boolean
20 explicit FunctionData(const char *name = NULL, int pos = 0, int count = 0)
21 : m_pos(pos), m_count(count) { if (name != NULL) m_name = mcopystr(name); }
22 ~FunctionData() { Free(m_name); }
23 inline const char *get_name() const { return m_name; }
24 inline int get_pos() const { return m_pos; }
25 inline int get_count() const { return m_count; }
26 inline void reset() { m_count = 0; }
27 FunctionData& operator++() { ++m_count; return *this; }
29 /// Copy constructor disabled
30 FunctionData(const FunctionData&);
31 /// %Assignment disabled
32 FunctionData& operator=(const FunctionData&);
34 int m_pos; // For later improvement.
41 explicit LineData(int no = 0, int count = 0): m_no(no), m_count(count) { }
42 inline int get_no() const { return m_no; }
43 inline int get_count() const { return m_count; }
44 inline void reset() { m_count = 0; }
45 LineData& operator++() { ++m_count; return *this; }
47 /// Copy constructor disabled
48 LineData(const LineData&);
49 /// %Assignment disabled
50 LineData& operator=(const LineData&);
58 explicit FileData(const char *file_name);
60 inline const char *get_file_name() const { return m_file_name; }
61 inline const Vector<FunctionData *>& get_function_data() const { return m_function_data; }
62 inline const Vector<LineData *>& get_line_data() const { return m_line_data; }
63 void inc_function(const char *function_name, int line_no);
64 void inc_line(int line_no);
65 void init_function(const char *function_name);
66 void init_line(int line_no);
67 size_t has_line_no(int line_no);
68 size_t has_function_name(const char *function_name);
71 /// Copy constructor disabled
72 FileData(const FileData&);
73 /// %Assignment disabled
74 FileData& operator=(const FileData&);
76 Vector<FunctionData *> m_function_data;
77 Vector<LineData *> m_line_data;
80 // We all belong to the _same_ component.
84 static void hit(const char *file_name, int line_no, const char *function_name = NULL);
85 static void init_file_lines(const char *file_name, const int line_nos[], size_t line_nos_len);
86 static void init_file_functions(const char *file_name, const char *function_names[], size_t function_names_len);
87 static expstring_t comp(boolean withname = FALSE);
88 static void close_file();
90 /// Copy constructor disabled
91 TCov(const TCov& tcov);
92 /// %Assignment disabled
93 TCov& operator=(const TCov& tcov);
94 static size_t has_file_name(const char *file_name);
95 static void pid_check();
97 static Vector<FileData *> m_file_data;
99 static expstring_t mycomp;
100 static expstring_t mycomp_name;
101 static int ver_major;
102 static int ver_minor;