summaryrefslogtreecommitdiff
path: root/ACE/examples/APG/Streams/MessageInfo.h
blob: 76d1502f0f92fdbe3ef3f35867a05226ade9858e (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* -*- C++ -*- */
// $Id$

#ifndef MESSAGE_INFO_H
#define MESSAGE_INFO_H

#include "ace/FILE_Addr.h"
#include "ace/SString.h"

/* Opaque class that represents a caller's ID */
class CallerId
{
public:
  CallerId () : id_ (ACE_TEXT ("UNKNOWN"))
  { }

  CallerId (ACE_TString id) : id_(id)
  { }

  const ACE_TCHAR * string(void)
  {
    return this->id_.c_str ();
  }

private:
  ACE_TString id_;
};

class MessageType
{
public:
  enum {
    // Known video codecs
    FIRST_VIDEO_CODEC = 1,

    DIVX,
    // ...
    LAST_VIDEO_CODEC,

    // Known audio codecs
    FIRST_AUDIO_CODEC,

    MP3,
    RAWPCM,
    // ...
    LAST_AUDIO_CODEC,

    // Known text codecs
    FIRST_TEXT_CODEC,

    RAWTEXT,
    XML,

    // ...
    LAST_TEXT_CODEC,

    LAST_CODEC
  };

  MessageType (int codec, const ACE_FILE_Addr& addr)
    : codec_(codec), addr_(addr)
  { }

  int get_codec (void)
  {
    return this->codec_;
  }

  ACE_FILE_Addr &get_addr (void)
  {
    return this->addr_;
  }

  int is_video (void)
  {
    return
      this->get_codec () > FIRST_VIDEO_CODEC &&
      this->get_codec () < LAST_VIDEO_CODEC;
  }

  int is_audio (void)
  {
    return
      this->get_codec () > FIRST_AUDIO_CODEC &&
      this->get_codec () < LAST_AUDIO_CODEC ;
  }

  int is_text (void)
  {
    return
      this->get_codec () > FIRST_TEXT_CODEC &&
      this->get_codec () < LAST_TEXT_CODEC ;
  }

private:
  int codec_;
  ACE_FILE_Addr addr_;
};

# endif /* MESSAGE_INFO_H */