summaryrefslogtreecommitdiff
path: root/modules/CIAO/tools/Config_Handlers/Dump_Obj.h
blob: d8e90351ad16795a59bf67c567540f6b5b291fa6 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//==================================================================
/**
*  @file  Dump_Obj.h
*
* $Id$
*
*  @author Gan Deng <gan.deng@vanderbilt.edu>
*/
//=====================================================================

#ifndef CIAO_DUMP_OBJ_H
#define CIAO_DUMP_OBJ_H
#include /**/ "ace/pre.h"

#include "ciao/DeploymentC.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "Config_Handlers_Export.h"
#include <string>
#include <map>

namespace Deployment
{
/*
*  @brief class Dump_Obj handles the indentation and keeps a map of
* structures for reference look-up.
*/
class Config_Handlers_Export Dump_Obj
{
public:
/// Exception thrown when there is a node with the same name in the
/// map
class Node_Exist { };

/// Exception thrown when there is no node with the name given in
/// the map
class Node_Not_Exist { };

/// Constructors prints out the caption and increases indent
Dump_Obj (const char *caption);

/// Additionally insets <val> into the map
Dump_Obj (const char* caption,
CORBA::Any &val);

// Destructor
~Dump_Obj (void);
// return the indent string
static const char* indent()
{
return indent_.c_str();
}

static CORBA::Any& desc(const char* caption)
{
return desc_map_[caption];
}

private:
// indent string
static std::string indent_;

// map for reference lookup
static std::map<std::string, CORBA::Any> desc_map_;

// descriptor - used by destructor for deleting the
// correct descriptor from the map
std::string desc_;
};
}

#include /**/ "ace/post.h"
#endif /*CIAO_DUMP_OBJ_H*/