OpenIndiana and Solaris port
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / Basic / NodeID.hh
1 /*
2  * $XConsortium: NodeID.hh /main/3 1996/06/11 16:20:47 cde-hal $
3  *
4  * Copyright (c) 1991 HaL Computer Systems, Inc.  All rights reserved.
5  * UNPUBLISHED -- rights reserved under the Copyright Laws of the United
6  * States.  Use of a copyright notice is precautionary only and does not
7  * imply publication or disclosure.
8  * 
9  * This software contains confidential information and trade secrets of HaL
10  * Computer Systems, Inc.  Use, disclosure, or reproduction is prohibited
11  * without the prior express written permission of HaL Computer Systems, Inc.
12  * 
13  *                         RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the Government is subject to
15  * restrictions as set forth in subparagraph (c)(l)(ii) of the Rights in
16  * Technical Data and Computer Software clause at DFARS 252.227-7013.
17  *                        HaL Computer Systems, Inc.
18  *                  1315 Dell Avenue, Campbell, CA  95008
19  * 
20  */
21
22 #include <string.h>
23
24 class NodeID {
25   public:
26     NodeID(const char *filename);
27     ~NodeID();
28     const char *filename()      { return f_filename ; }
29     const char *node_name (node_name_style_t)
30       // NOTE: temp hack
31       { return f_filename; }
32
33   private:
34     char        *f_filename ;
35 };
36
37 inline
38 NodeID::NodeID(const char *filename)
39 {
40     int len = strlen(filename);
41     f_filename = new char[len + 1] ;
42     *((char *) memcpy(f_filename, filename, len) + len) = '\0';
43 }
44
45 inline 
46 NodeID::~NodeID()
47 {
48     delete f_filename ;
49 }