Loading...
Searching...
No Matches
satellite-log.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2014 Magister Solutions Ltd.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Frans Laakso <frans.laakso@magister.fi>
19 */
20#ifndef SATELLITE_LOG_H
21#define SATELLITE_LOG_H
22
23#include "ns3/satellite-output-fstream-string-container.h"
24
25#include <map>
26#include <string>
27#include <utility>
28
29namespace ns3
30{
31
56class SatLog : public Object
57{
58 public:
62 typedef enum
63 {
69 } LogType_t;
70
74 typedef std::pair<LogType_t, std::string> key_t;
75
79 typedef std::map<key_t, Ptr<SatOutputFileStreamStringContainer>> container_t;
80
84 SatLog();
85
89 ~SatLog();
90
95 static TypeId GetTypeId(void);
96
100 void DoDispose();
101
108 void AddToLog(LogType_t logType, std::string fileTag, std::string message);
109
113 void Reset();
114
115 private:
121 std::string GetFileTag(LogType_t logType);
122
129 Ptr<SatOutputFileStreamStringContainer> CreateLog(LogType_t logType, std::string fileTag);
130
137 Ptr<SatOutputFileStreamStringContainer> FindLog(LogType_t logType, std::string fileTag);
138
142 void WriteToFile();
143
148};
149
150} // namespace ns3
151
152#endif /* SATELLITE_LOG_H */
SatLog()
Constructor.
void DoDispose()
Do needed dispose actions.
std::map< key_t, Ptr< SatOutputFileStreamStringContainer > > container_t
typedef for map of containers
void WriteToFile()
Write the contents of a container matching to the key into a file.
Ptr< SatOutputFileStreamStringContainer > CreateLog(LogType_t logType, std::string fileTag)
Function for creating a log.
std::pair< LogType_t, std::string > key_t
typedef for container key
std::string GetFileTag(LogType_t logType)
Function for getting the file tag for predefined log types.
void Reset()
Function for resetting the variables.
~SatLog()
Destructor.
Ptr< SatOutputFileStreamStringContainer > FindLog(LogType_t logType, std::string fileTag)
Function for finding a log based on the key.
void AddToLog(LogType_t logType, std::string fileTag, std::string message)
Function for adding a line to a specific log.
container_t m_container
Map for containers.
static TypeId GetTypeId(void)
NS-3 type id function.
LogType_t
Enum for log types.
@ LOG_ERROR
LOG_ERROR.
@ LOG_WARNING
LOG_WARNING.
@ LOG_CUSTOM
LOG_CUSTOM.
@ LOG_GENERIC
LOG_GENERIC.
@ LOG_INFO
LOG_INFO.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.