mp_s_pattern.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
  24. /*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
  25. /*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
  26. /*%% (c) Copyright 1993, 1994 Novell, Inc. */
  27. /*%% $XConsortium: mp_s_pattern.h /main/3 1995/10/23 11:57:50 rswiston $ */
  28. /* -*-C++-*-
  29. *
  30. * @(#)mp_s_pattern.h 1.7 29 Jul 1993
  31. *
  32. * Tool Talk Message Passer (MP) - mp_s_pattern.h
  33. *
  34. * Copyright (c) 1990, 1992 by Sun Microsystems, Inc.
  35. *
  36. * This file implements the server side of the _Tt_pattern object.
  37. */
  38. #ifndef _MP_S_PATTERN_H
  39. #define _MP_S_PATTERN_H
  40. #include "mp/mp_pattern.h"
  41. #include "mp/mp_arg_utils.h"
  42. #include "mp_ptype_utils.h"
  43. #include "mp_s_pattern_utils.h"
  44. #include "mp_signature_utils.h"
  45. class _Tt_msg_trace;
  46. class _Tt_s_message;
  47. class _Tt_s_pattern : public _Tt_pattern {
  48. public:
  49. _Tt_s_pattern();
  50. _Tt_s_pattern(const _Tt_signature_ptr &sig);
  51. virtual ~_Tt_s_pattern();
  52. int match(
  53. const _Tt_s_message &m,
  54. const _Tt_msg_trace &trace
  55. ) const;
  56. Tt_status add_arg(const _Tt_arg_ptr &arg);
  57. Tt_status join_context(const _Tt_msg_context &context);
  58. Tt_status quit_context(const _Tt_msg_context &context);
  59. _Tt_ptype_ptr &generating_ptype(); // ptype it was generated
  60. // by declaring
  61. _Tt_ptype_ptr &generating_ptype(_Tt_ptype_ptr &pt); // set it
  62. int is_from_ptype(); // true if generated by
  63. // declaring a ptype
  64. unsigned int timestamp() const
  65. { return _timestamp; }
  66. void set_timestamp(unsigned int stamp)
  67. { _timestamp = stamp; }
  68. protected:
  69. // server-only methods that aid in matching patterns and
  70. // messages.
  71. int match_field(
  72. int val,
  73. const _Tt_int_rec_list_ptr &pvals,
  74. int &tm,
  75. const _Tt_msg_trace &trace,
  76. const char *failure_note
  77. ) const;
  78. int match_field(
  79. const _Tt_string &val,
  80. const _Tt_string_list_ptr &pvals,
  81. int &tm,
  82. const _Tt_msg_trace &trace,
  83. const char *failure_note
  84. ) const;
  85. int match_scopes(
  86. const _Tt_message &m,
  87. int &tm,
  88. const _Tt_msg_trace &trace
  89. ) const;
  90. int match_args(
  91. const _Tt_message &m,
  92. int &tm,
  93. const _Tt_msg_trace &trace
  94. ) const;
  95. int match_contexts(
  96. const _Tt_message &m,
  97. int &tm,
  98. const _Tt_msg_trace &trace
  99. ) const;
  100. private:
  101. _Tt_ptype_ptr _generating_ptype;
  102. unsigned int _timestamp;
  103. friend class _Tt_mp;
  104. friend class _Tt_message;
  105. };
  106. #include "mp_s_pattern_inlines.h"
  107. #endif /* _MP_S_PATTERN_H */