summaryrefslogtreecommitdiff
path: root/TAO/examples/Simulator/DOVEMIB/AnyAnalyser.h
blob: d3a9bb3ccf4b0280ce4f466c2371aac6d29d1ce5 (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
// $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"

#ifndef 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);

  void printTimeStamp (ACE_hrtime_t creation,
                       ACE_hrtime_t ec_recv,
                       ACE_hrtime_t ec_send);
  // Print the time stamp, which means forward this
  // call to the PrintVisitor

private:
  Node *analyse (CORBA::TypeCode_ptr tc_ptr,
                             const unsigned char *&value_ptr,
                 RecurseInfo recurseInfo);

  PrintVisitor *printVisitor_ptr_;
};

#endif