summaryrefslogtreecommitdiff
path: root/ace/CLASSIX/CLASSIX_OS.h
blob: e708a5e7d9e0c4280850de8d0bba8f81dabab02b (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//     ace
//
// = FILENAME
//     CLASSIX_OS.h
//
// = AUTHOR(S)
//     Nokia Telecommunications
//
// ============================================================================

#ifndef ACE_CLASSIX_OS_H
#define ACE_CLASSIX_OS_H

/* ------------------------------------------------------------------------- */
#include "ace/OS.h"

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

#include "ace/Select_Reactor.h"
#include "ace/Singleton.h"
#include "ace/CLASSIX/CLASSIX_Port_Core.h"

#include <ipc/chIpc.h>


#if 0
class ACE_Export ACE_CLASSIX_Mgr
    // = TITLE
    //   Class to manage resouces, especially static resources
    //
    // = DESCRIPTION
    //   It is intended that one <ACE_CLASSIX_Mgr> per actor
    //
{
 public:
    friend ACE_Singleton<ACE_CLASSIX_Mgr, ACE_SYNCH_NULL_MUTEX>;

    ACE_SYNCH_RECURSIVE_MUTEXT& ref_lock(const) const;

 protected:
    // = Initialization
    ACE_CLASSIX_Mgr(void);
    // Only allow its fried to instantiate, since it is meant as a
    // singleton class.
    // This class shall be instanti

private:
    ACE_SYNCH_RECURSIVE_MUTEX   *port_lock_;
};
#endif

class ACE_Export ACE_CLASSIX_OS
{
public:

    ACE_CLASSIX_OS();

    static const KnUniqueId&  null_KnUniqueId();
    static ssize_t convert_io_error (ssize_t /* CLASSIX' error no */);
    // conver CLASSIX's errno no to Posix no.

protected:

private:
    friend class ACE_CLASSIX_Port_Core;
    friend class ACE_CLASSIX_Port;
    static ACE_Recursive_Thread_Mutex& get_lock_(void);
    // Returns CLASSIX environment-wide lock

    static KnUniqueId                        null_KnUniqueId_;
    // Null-filled KnUniqueId

    static ACE_Recursive_Thread_Mutex        lock_;
};

/* ------------------------------------------------------------------------- */


class ACE_CLASSIX_Msg
    // = TITLE
    //   Class wrapper over Chorus's KnMsgDesc structure
    //
    // = DESCRIPTION
    //   Provides initialization and reset methods to construct a KnMsgDesc.
    //
    //   The flags in the <flags> field of the KnMsgDesc structure is always
    //   set to 0. Therefore, the message body will always be copied and
    //   the message is assumed to be part of the user(kernel) address
    //   space when the caller is a USER(SUPERVISOR) thread.
    //   (Chorus may not support the options defined in the flag, so we
    //   choose not to use the flag, i.e. set it to null).
    //
    //   The message annex is not used.

    // = SEE ALSO
    //   ipcSend(2)
{
 public:
    // = initialization
    ACE_CLASSIX_Msg();
    // default constructor
    ACE_CLASSIX_Msg(const void * /* body address */, int /* msg length */);

    KnMsgDesc* get(void);
    // get CLASSIX' message structure
    void set (const void* /* body address */, int /* msg length*/);
    // Reset the message.  The original message will be overwritten.

    void dump(void) const;

    ACE_ALLOC_HOOK_DECLARE;
    // declare the dynamic allocation hooks

 private:
    KnMsgDesc    msg_;
};

/* ------------------------------------------------------------------------- */

#if defined (__ACE_INLINE__)
#include "ace/CLASSIX/CLASSIX_OS.i"
#endif /* __ACE_INLINE__ */

#endif /* ACE_CLASSIX_OS_H */