summaryrefslogtreecommitdiff
path: root/TAO/utils/logWalker/Session.h
blob: 7e944fc570133b35562e192f04a6e71d9a8ea908 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// -*- C++ -*-

// $Id$
//

#ifndef LOG_WALKER_SESSION_H
#define LOG_WALKER_SESSION_H

#include "ace/Hash_Map_Manager.h"
#include "ace/RB_Tree.h"
#include "ace/Functor.h"
#include "ace/SString.h"
#include "ace/Synch.h"

class Log;
class HostProcess;

typedef ACE_RB_Tree<long, HostProcess *, ACE_Less_Than<long>, ACE_Null_Mutex> Processes;
typedef ACE_RB_Tree<ACE_CString, HostProcess *, ACE_Less_Than<ACE_CString>, ACE_Null_Mutex> Procs_By_Name;
typedef ACE_Hash_Map_Manager<ACE_CString, ACE_CString, ACE_Null_Mutex> AltAddresses;

class Session
{
public:
  Session ();

  ~Session (void);

  void add_process (HostProcess *proc);
  HostProcess *find_process (long pid);
  HostProcess *find_host (ACE_CString &endpoint, bool server);
  void reconcile (void);

  static bool set_tao_version (ACE_TCHAR *str);
  static long tao_version (void);
  static int date_format (void);
  static bool set_date_format (ACE_TCHAR *ser);

  void alternate_address (const char *string);
  void default_service (const char *string);

  void make_dir (const char * );
  void outfile (const char * );

  bool has_dir (void);
  bool has_outfile (void);

  void dump ();

private:
  ostream * stream_for ( ostream *, HostProcess * = 0, const char * = 0);

  Processes processes_;
  Procs_By_Name procs_by_name_;
  AltAddresses alt_addrs_;
  ACE_CString base_dir_;
  ACE_CString outfile_;
  static long tao_version_;
  static int date_format_;
};

#endif // LOG_WALKER_SESSION_H