This file is indexed.

/usr/include/libscscp/scscpxx.h is in libscscp1-dev 1.0.3+ds-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
/*-----------------------------------------------------------------*/
/*! 
  \file scscpxx.h
  \brief SCSCP library - C++ interface.
  \author  M. Gastineau 
           Astronomie et Systemes Dynamiques, IMCCE, CNRS, Observatoire de Paris. 

   Copyright, 2008,2009,2010,2012,2013,2014,2015,2016,2017, M. Gastineau, IMCCE-CNRS
   email of the author : Mickael.Gastineau@obspm.fr

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

/*-----------------------------------------------------------------*/
/* License  of this file :
 This file is "dual-licensed", you have to choose one  of the two licenses 
 below to apply on this file.
 
    CeCILL-C
    	The CeCILL-C license is close to the GNU LGPL.
    	( http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.html )
 
 or CeCILL v2.0
      The CeCILL license is compatible with the GNU GPL.
      ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html )
 

This library is governed by the CeCILL-C or the CeCILL license under 
French law and abiding by the rules of distribution of free software.  
You can  use, modify and/ or redistribute the software under the terms 
of the CeCILL-C or CeCILL license as circulated by CEA, CNRS and INRIA  
at the following URL "http://www.cecill.info". 

As a counterpart to the access to the source code and  rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty  and the software's author,  the holder of the
economic rights,  and the successive licensors  have only  limited
liability. 

In this respect, the user's attention is drawn to the risks associated
with loading,  using,  modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean  that it is complicated to manipulate,  and  that  also
therefore means  that it is reserved for developers  and  experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or 
data to be ensured and,  more generally, to use and operate it in the 
same conditions as regards security. 

The fact that you are presently reading this means that you have had
knowledge of the CeCILL-C or CeCILL license and that you accept its terms.
*/
/*-----------------------------------------------------------------*/

#ifndef __SCSCPXX_H__
#define __SCSCPXX_H__


#include <scscp.h>
#include <ostream>

/*----------------------------------------------------------------------------------------------*/
/* define the SCSCP namespace  */
/*----------------------------------------------------------------------------------------------*/
namespace SCSCP
{

class ProcedureCall;
class ClientComputation;
class Client;
class Server;
class ServerComputation;
class Ofmtstream;
class Iunfstream;

/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class Exception
    \brief  SCSCP C++  exception 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class Exception : public std::exception
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   explicit Exception(const SCSCP_status* status) ;
   Exception(const Exception& e);
   virtual ~Exception() throw ();
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! information about the error
   virtual const char * what() const throw();
   
private:

   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   SCSCP_status       m_status; //!< status
};

#if __cplusplus<201103L
#define THROW_EXCEPTION throw (Exception)
#else
#define THROW_EXCEPTION
#endif


/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class Client
    \brief  SCSCP C++  client 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class Client 
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // types
   ////////////////////////////////////////////////////////////////////////////
   typedef ClientComputation Computation;
 
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   Client();
   ~Client();
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   /*! connect the client to a server on the specified host and port */
   int connect( const char *machine, int port=SCSCP_PROTOCOL_DEFAULTPORT) THROW_EXCEPTION;
   //! close the connection of the client to a server previously opened by Connect
   int close() THROW_EXCEPTION;
   //! return true if the connection is closed
   bool eof() const;
   
private:
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   SCSCP_socketclient m_client; //!< client
   SCSCP_status       m_status; //!< status
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! set the status
   void set_status(SCSCP_status* status);

   ////////////////////////////////////////////////////////////////////////////
   //friends
   ////////////////////////////////////////////////////////////////////////////
   friend class ClientComputation;
   friend class ProcedureCall;
};

/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class IncomingClient
    \brief  SCSCP C++  incoming client for the server
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class IncomingClient 
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // types
   ////////////////////////////////////////////////////////////////////////////
   typedef ServerComputation Computation;
 
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   ~IncomingClient();
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! return true if the connection is closed
   bool eof() const;
   
private:
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   SCSCP_incomingclient m_client; //!< client
   SCSCP_status         m_status; //!< status

   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   IncomingClient(SCSCP_incomingclient* client);
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! set the status
   void set_status(SCSCP_status* status);

   ////////////////////////////////////////////////////////////////////////////
   //friends
   ////////////////////////////////////////////////////////////////////////////
   friend class ClientComputation;
   friend class ProcedureCall;
   friend class Server;
};

/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class Server
    \brief  SCSCP C++  server 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class Server 
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // types
   ////////////////////////////////////////////////////////////////////////////
   typedef ServerComputation Computation;
 
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   Server(const char* servicename, const char* serviceversion, const char* serviceid);
   ~Server();
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! listen on the specified  port 
   int listen(int port=SCSCP_PROTOCOL_DEFAULTPORT) THROW_EXCEPTION;
   //! stop to listen
   int close() THROW_EXCEPTION;
   //! waits for an incoming connection and accepts a incoming client connection  
   IncomingClient* acceptclient()   THROW_EXCEPTION;
   //! return the port 
   int getport();
   
   
private:
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   SCSCP_socketserver m_server; //!< server
   SCSCP_status       m_status; //!< status
};

/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class OMBase
    \brief  OpenMath base 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class OMBase 
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! constructor
   OMBase(const char *id=NULL) : m_id(id) {};
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! get the sharing id
   const char *get_id() const { return m_id; }
   //! set the sharing id
   void set_id(const char *id) { m_id = id; }
   
private:
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   const char*     m_id;    //!< sharing id
};

/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*! \ internal
    @class OMBasenode
    \brief  OpenMath base for complex construction
     must not be used by user application
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class OMBasenode : public OMBase
{   
protected:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   OMBasenode(SCSCP_xmlnodeptr node, const char *id=NULL) : OMBase(id), m_node(node) {};

   //! return the stream to parse the content of a derived OM
   Iunfstream beginOM();

private:
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   SCSCP_xmlnodeptr     m_node;    //!< value
};

/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class OMA
    \brief  OpenMath application 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class OMA : public OMBasenode
{
private:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   OMA(SCSCP_xmlnodeptr node, const char *id=NULL) : OMBasenode(node, id) {};
};


/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class OMB
    \brief  OpenMath array of bytes 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class OMB : public OMBase
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   OMB(const void *value=NULL, size_t len=0, const char *id=NULL) : OMBase(id), m_value(value), m_len(len) {};
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! get the value
   const void *get_value() const { return m_value; }
   //! get the length
   size_t get_size() const { return m_len; }
   //! set the value
   void set_value(const void *value, size_t len)  {  m_value = value; m_len = len; }
   
private:
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   const void*     m_value;    //!< value
   size_t          m_len; //! length of m_value
};

/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class OMBIND
    \brief  OpenMath bind 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class OMBIND : public OMBasenode
{
private:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   OMBIND(SCSCP_xmlnodeptr node, const char *id=NULL) : OMBasenode(node, id) {};
};


/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class OME
    \brief  OpenMath error 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class OME : public OMBasenode
{
private:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   OME(SCSCP_xmlnodeptr node, const char *id=NULL) : OMBasenode(node, id) {};
};


/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class OMF
    \brief  OpenMath float 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class OMF : public OMBase
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   OMF(const char *value=NULL, const char *id=NULL) : OMBase(id), m_value(value), m_base(10) {};
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! get the value
   const char *get_value() const { return m_value; }
   //! get the base
   int get_base() const { return m_base; }
   //! get the value as a double
   //operator double() const;
   //! set the value
   void set_value(const char *value)  {  m_value = value; m_base= 10; }
   
private:
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! set the value
   void set_value(const char *value, int base)  {  m_value = value; m_base= base; }
   
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   const char*     m_value;    //!< value
   int             m_base;     //!< base
   
   friend class Iunfstream;
};

/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class OMI
    \brief  OpenMath integer 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class OMI : public OMBase
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   OMI(const char *value=NULL, const char *id=NULL) : OMBase(id), m_value(value) {};
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! get the value
   const char *get_value() const { return m_value; }
   //! set the value
   void set_value(const char *value)  {  m_value = value; }
   
private:
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   const char*     m_value;    //!< value
};

/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class OMR
    \brief  OpenMath reference 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class OMR : public OMBase
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   OMR(const char *name=NULL) : OMBase(NULL), m_name(name) {};
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! get the reference
   const char *get_reference() const { return m_name; }
   //! set the reference
   void set_reference(const char *href)  {  m_name = href; }
   
private:
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   const char*     m_name;    //!< name
};

/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class OMS
    \brief  OpenMath symbol 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class OMS : public OMBase
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! constructor
   OMS(const char *cd=NULL, const char *symbol=NULL, const char *id=NULL) : OMBase(id), m_cdname(cd), m_symbolname(symbol) {};
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! get the cd name
   const char *get_cdname() const { return m_cdname; }
   //! set the cd name
   void set_cdname(const char *cdname)  { m_cdname = cdname; }
   //! get the symbol name
   const char *get_symbolname() const { return m_symbolname; }
   //! set the symbol name
   void set_symbolname(const char *symbolname) { m_symbolname = symbolname; }
   
private:
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   const char*     m_cdname;    //!< cdname
   const char*     m_symbolname;    //!< symbolname
};

/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class OMV
    \brief  OpenMath variable 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class OMV : public OMBase
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   OMV(const char *name=NULL, const char *id=NULL) : OMBase(id), m_name(name){};
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! get the name
   const char *get_name() const { return m_name; }
   //! set the name
   void set_name(const char *name)  {  m_name = name; }
   
private:
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   const char*     m_name;    //!< name
};



/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class Ounfstream
    \brief  unformatted OpenMath output stream 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class Ounfstream 
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   Ounfstream(SCSCP_io* stream, SCSCP_status* status);
   ~Ounfstream();
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   Ounfstream& operator<< (Ounfstream& ( *pf )(Ounfstream&) );
   
private:
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   SCSCP_io*     m_stream;    //!< input stream
   SCSCP_status* m_status;    //!< status
   
   ////////////////////////////////////////////////////////////////////////////
   // private members
   ////////////////////////////////////////////////////////////////////////////
   // friends
   friend Ounfstream& operator <<(Ounfstream& out, int x) THROW_EXCEPTION;
   friend Ounfstream& operator <<(Ounfstream& out, double x) THROW_EXCEPTION;
   friend Ounfstream& operator <<(Ounfstream& out, const char* str) THROW_EXCEPTION;
   friend Ounfstream& operator <<(Ounfstream& out, const OMS& x) THROW_EXCEPTION;
   friend Ounfstream& operator <<(Ounfstream& out, const OMR& x) THROW_EXCEPTION;
   friend Ounfstream& operator <<(Ounfstream& out, const OMV& x) THROW_EXCEPTION;
   friend Ounfstream& operator <<(Ounfstream& out, const OMI& x) THROW_EXCEPTION;
   friend Ounfstream& operator <<(Ounfstream& out, const OMF& x) THROW_EXCEPTION;
   friend Ounfstream& operator <<(Ounfstream& out, const OMB& x) THROW_EXCEPTION;
   friend Ounfstream& beginOMA(Ounfstream& out) THROW_EXCEPTION;
   friend Ounfstream& endOMA(Ounfstream& out) THROW_EXCEPTION;
   friend Ounfstream& beginOMATP(Ounfstream& out) THROW_EXCEPTION;
   friend Ounfstream& endOMATP(Ounfstream& out) THROW_EXCEPTION;
   friend Ounfstream& beginOMATTR(Ounfstream& out) THROW_EXCEPTION;
   friend Ounfstream& endOMATTR(Ounfstream& out) THROW_EXCEPTION;
   friend Ounfstream& beginOME(Ounfstream& out) THROW_EXCEPTION;
   friend Ounfstream& endOME(Ounfstream& out) THROW_EXCEPTION;
   friend Ounfstream& beginOMOBJ(Ounfstream& out) THROW_EXCEPTION;
   friend Ounfstream& endOMOBJ(Ounfstream& out) THROW_EXCEPTION;
};

/* unformatted stream operation */
Ounfstream& operator <<(Ounfstream& out, int x) THROW_EXCEPTION;
Ounfstream& operator <<(Ounfstream& out, double x) THROW_EXCEPTION;
Ounfstream& operator <<(Ounfstream& out, const char* str) THROW_EXCEPTION;
Ounfstream& operator <<(Ounfstream& out, const OMS& x) THROW_EXCEPTION;
Ounfstream& operator <<(Ounfstream& out, const OMR& x) THROW_EXCEPTION;
Ounfstream& operator <<(Ounfstream& out, const OMV& x) THROW_EXCEPTION;
Ounfstream& operator <<(Ounfstream& out, const OMI& x) THROW_EXCEPTION;
Ounfstream& operator <<(Ounfstream& out, const OMF& x) THROW_EXCEPTION;
Ounfstream& operator <<(Ounfstream& out, const OMB& x) THROW_EXCEPTION;
Ounfstream& beginOMA(Ounfstream& out) THROW_EXCEPTION;
Ounfstream& endOMA(Ounfstream& out) THROW_EXCEPTION;
Ounfstream& beginOMATP(Ounfstream& out) THROW_EXCEPTION;
Ounfstream& endOMATP(Ounfstream& out) THROW_EXCEPTION;
Ounfstream& beginOMATTR(Ounfstream& out) THROW_EXCEPTION;
Ounfstream& endOMATTR(Ounfstream& out) THROW_EXCEPTION;
Ounfstream& beginOME(Ounfstream& out) THROW_EXCEPTION;
Ounfstream& endOME(Ounfstream& out) THROW_EXCEPTION;
Ounfstream& beginOMOBJ(Ounfstream& out) THROW_EXCEPTION;
Ounfstream& endOMOBJ(Ounfstream& out) THROW_EXCEPTION;


/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class Iunfstream_iterator_attr
    \brief  iterator on atributes of the OpenMath object
     This class must only used through  Iunfstream::iterator_attr
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class Iunfstream_iterator_attr 
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   Iunfstream_iterator_attr(SCSCP_xmlattrptr attr);
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! return false if eof
   bool end() const { return m_attr!=NULL; }
   //! jump to the next attribute
   void operator++();
   //! get the name of the attribute
   const char *get_name() const;
   //! get the value of the attribute
   const char *get_value() const;
   
private:
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   SCSCP_xmlattrptr m_attr;    //!< attributes
};


/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class Iunfstream
    \brief  unformatted OpenMath input stream 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class Iunfstream 
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // types
   ////////////////////////////////////////////////////////////////////////////
   //! iterator on attributes
   typedef Iunfstream_iterator_attr iterator_attr;
   //! OpenMath node type
   typedef SCSCP_omtype omtype;
   
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   Iunfstream();
   ~Iunfstream();
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! return true if eof
   bool eof() const { return m_node==NULL; }
   //! get the list of attributes 
   iterator_attr get_attr();
   //! get the type of the current node
   omtype get_type() const;
   //! get the name of the current node
   const char* get_typename() const;
   //! get the content of the current node
   const char* get_content() const;
   //! return the stream to parse the content of a derived OM
   Iunfstream beginOM();
   
   /* unformatted stream operation */
   Iunfstream& operator >>(int& x) THROW_EXCEPTION;
   Iunfstream& operator >>(double& x) THROW_EXCEPTION;
   Iunfstream& operator >>(const char*& str) THROW_EXCEPTION;
   Iunfstream& operator >>(OMA& x) THROW_EXCEPTION;
   Iunfstream& operator >>(OMB& x) THROW_EXCEPTION;
   Iunfstream& operator >>(OMBIND& x) THROW_EXCEPTION;
   Iunfstream& operator >>(OME& x) THROW_EXCEPTION;
   Iunfstream& operator >>(OMF& x) THROW_EXCEPTION;
   Iunfstream& operator >>(OMI& x) THROW_EXCEPTION;
   Iunfstream& operator >>(OMR& x) THROW_EXCEPTION;
   Iunfstream& operator >>(OMS& x) THROW_EXCEPTION;
   Iunfstream& operator >>(OMV& x) THROW_EXCEPTION;
   
private:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   Iunfstream(SCSCP_xmlnodeptr node, SCSCP_status* status);

   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   SCSCP_xmlnodeptr m_node;    //!< input stream
   SCSCP_status* m_status;    //!< status
   
   friend class ProcedureCall;
   friend class OMBasenode;
};



/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class ProcedureCall
    \brief  SCSCP C++  Procedure Call  : common part on server or client 
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class ProcedureCall 
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   ProcedureCall(Client& session) THROW_EXCEPTION;
   ProcedureCall(IncomingClient& session) THROW_EXCEPTION;
   ~ProcedureCall();
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   /* for send options */
   /*! set the runtime limit */
   int set_runtimelimit(size_t p_time);
   /*! get the runtime limit */
   int get_runtimelimit(size_t& p_time) ;
   /*! set the minimum memory */
   int set_minmemory(size_t memsize);
   /*! get the minimum memory */
   int get_minmemory(size_t& memsize);
   /*! set the maximum memory */
   int set_maxmemory(size_t memsize);
   /*! get the maximum memory */
   int get_maxmemory(size_t& memsize);
   /*! set the debug level */
   int set_debuglevel(int debuglevel);
   /*! get the debug level */
   int get_debuglevel(int& debuglevel);
   //! set encoding XML or binary
   int set_encodingtype(SCSCP_encodingtype encodingtype);
   //! get encoding type
   int get_encodingtype(SCSCP_encodingtype& encoding);
   //! get the return type
   int get_returntype(SCSCP_option_return& returntype);
   //! get the call id
   int get_callid(const char*& callid);

   /* for return options */
   /*! set the runtime usage */
   int set_runtime(size_t p_time);
   /*! get the runtime usage */
   int get_runtime(size_t& p_time);
   /*! set the memory usage */
   int set_memory(size_t mem);
   /*! get the memory usage */
   int get_memory(size_t& mem);
   /*! set the information message */
   int set_message(const char *buffer);
   /*! get the information message */
   int get_message(const char *& buffer);

   /*! send a information message */
   int sendinfomessage(const char *buffer);
   
protected :
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! fush the output stream
   void flushostream();
   //! create an unformatted output stream
   Ounfstream* createounfstream() throw();
   //! create a formatted output stream
   Ofmtstream* createofmtstream() throw();
   //! create an unformatted input stream
   Iunfstream* createiunfstream(SCSCP_xmlnodeptr node) throw();
   //! get call options
   SCSCP_calloptions *get_calloptions() { return &m_calloptions; }
   //! get return options
   SCSCP_returnoptions *get_returnoptions() { return &m_returnoptions; }
   //! get status
   SCSCP_status *get_status() { return &m_status; }
   //! get client
   SCSCP_socketclient *get_client() { return m_client; }
   //! report error if res=0 and raise an exception
   void report_error(int res) THROW_EXCEPTION;

private:
   ////////////////////////////////////////////////////////////////////////////
   // attributes
   ////////////////////////////////////////////////////////////////////////////
   SCSCP_socketclient* m_client; //!< client
   Client*             m_clientsession; //!< session client side
   IncomingClient*     m_serversession; //!< session client side
   SCSCP_calloptions  m_calloptions; //!< options of the call
   SCSCP_returnoptions m_returnoptions; //!< options of the reply 
   SCSCP_status       m_status; //!< status
   Ofmtstream         *m_postream; //!< output formatted stream
   Ounfstream         *m_punfostream; //!< output unformatted stream
   Iunfstream         *m_punfistream; //!< input unformatted stream
};


/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class ClientComputation
    \brief  SCSCP C++  computation task for client side
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class ClientComputation : public ProcedureCall
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   ClientComputation(Client& session) THROW_EXCEPTION;
   ~ClientComputation();
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   //! send an interruption of the call
   int interrupt();
   
   ////////////////////////////////////////////////////////////////////////////
   //procedure call using buffer
   ////////////////////////////////////////////////////////////////////////////
   //! send a procedure call using an openmath buffer to the server
   int send(const char *openmathbuffer, size_t lenbuffer, SCSCP_option_return returntype)  THROW_EXCEPTION ;
   //! wait and receive an answer from the server
   int recv(SCSCP_msgtype& msgtype, char*& openmathbuffer, size_t& lenbuffer)  THROW_EXCEPTION ;
   
   ////////////////////////////////////////////////////////////////////////////
   //procedure call using streams
   ////////////////////////////////////////////////////////////////////////////
   //! send a procedure call using a stream to the server (direct output OpenMath) 
   int send(SCSCP_option_return returntype, std::ostream*& stream)  THROW_EXCEPTION ;
   //! send a procedure call using a stream to the server (format to OpenMath) 
   int send(SCSCP_option_return returntype, Ounfstream*& stream)  THROW_EXCEPTION ;
   //! discard the procedure call to the server (after send...formattedstream)
   int discard()  THROW_EXCEPTION ;
   //! complete the procedure call to the server (after send...formattedstream)
   int finish()  THROW_EXCEPTION ;
   //! wait and receive an answer from the server
   int  recv(SCSCP_msgtype& msgtype, Iunfstream* &stream)  THROW_EXCEPTION ;
};


/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
/*!
    @class ServerComputation
    \brief  SCSCP C++  computation task for server side
*/
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
class ServerComputation : public ProcedureCall
{
 public:
   ////////////////////////////////////////////////////////////////////////////
   // constructor destructor
   ////////////////////////////////////////////////////////////////////////////
   //! default constructor
   ServerComputation(IncomingClient& session) THROW_EXCEPTION;
   ~ServerComputation();
   
   ////////////////////////////////////////////////////////////////////////////
   // operation
   ////////////////////////////////////////////////////////////////////////////
   ////////////////////////////////////////////////////////////////////////////
   //procedure call using buffer
   ////////////////////////////////////////////////////////////////////////////
   //! wait and receive an command from the client
   int recv(SCSCP_msgtype& msgtype, char*& openmathbuffer, size_t& lenbuffer)  THROW_EXCEPTION ;
   //! send a completed message using an openmath buffer to the client
   int sendcompleted(const char* openmathbuffer=NULL, size_t lenbuffer=0)  THROW_EXCEPTION ;
   //! send a terminated message using an openmath buffer to the client
   int sendterminated(const char * cdname, const char * symbolname, const char * message)  THROW_EXCEPTION ;
   
   ////////////////////////////////////////////////////////////////////////////
   //procedure call using streams
   ////////////////////////////////////////////////////////////////////////////
   //! wait and receive an command from the client
   int recv(SCSCP_msgtype& msgtype, Iunfstream*& stream)  THROW_EXCEPTION ;
   //! send a completed message using a stream to the client (direct output OpenMath) 
   int sendcompleted(std::ostream*& stream)  THROW_EXCEPTION ;
   //! send a completed message using a stream to the client (format to OpenMath) 
   int sendcompleted(Ounfstream*& stream)  THROW_EXCEPTION ;
   //! complete the completed or terminated message to the client (after sendcompleted)
   int finish()  THROW_EXCEPTION ;

};

} /*namespace SCSCP */

#endif /*__SCSCPXX_H__*/