summaryrefslogtreecommitdiff
path: root/TAO/examples/Simulator/DOVEMIB/AnyAnalyser.h
blob: eeb0613c6611f70a456921f88d29c200ce3c6aae (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
// $Id$
// ============================================================================
//
// = LIBRARY
//
// = FILENAME
//    AnyAnalyser.h
//
// = AUTHOR
//    Michael Kircher 
//
// = DESCRIPTION
//   Accepts an CORBA::Any, traverses it, copies it into a tree structure
//   and prints out the tree.
//
// ============================================================================


#include "PrintVisitor.h"
#include "tao/corba.h"

#if !defined (ANYANALYSER_H)
#define ANYANALYSER_H

typedef enum {PARENT_IS_STRUCT, PARENT_IS_NO_STRUCT} KIND;

typedef struct {
          KIND kind;
          CORBA::TypeCode_ptr parent_tc_ptr;
          unsigned int member_number;
          unsigned int recursion_level;
} RecurseInfo;


class AnyAnalyser {

public:
  AnyAnalyser (const char *filename);
  
  ~AnyAnalyser ();

  // cause the PrintViewer to be deleted to close the file
  void close ();
  
  // main starting point includes analysing and printing
  void printAny (CORBA::TypeCode_ptr any_type, const void *any_value);
  
private:
  Node *analyse (CORBA::TypeCode_ptr tc_ptr, 
		             const unsigned char *&value_ptr,
                 RecurseInfo recurseInfo);

  PrintVisitor *printVisitor_ptr_;
};

#endif