Annotation of parser3/src/types/pa_vamqp.h, revision 1.2

1.1       moko        1: /** @file
                      2:        Parser: @b amqp class decls.
                      3: 
1.2     ! moko        4:        Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com)
1.1       moko        5:        Authors: Konstantin Morshnev <moko@design.ru>
                      6: */
                      7: 
                      8: #ifndef PA_VAMQP_H
                      9: #define PA_VAMQP_H
                     10: 
1.2     ! moko       11: #define IDENT_PA_VAMQP_H "$Id: pa_vamqp.h,v 1.1 2025/11/06 22:08:03 moko Exp $"
1.1       moko       12: 
                     13: #include "classes.h"
                     14: #include "pa_vstateless_object.h"
                     15: 
                     16: #ifdef WITH_AMQP
                     17: #include <amqp.h>
                     18: #endif
                     19: 
                     20: // defines
                     21: #define VAMQP_TYPE "amqp"
                     22: 
                     23: // externs
                     24: extern Methoded *amqp_class;
                     25: 
                     26: class VAmqp: public VStateless_object {
                     27: public:
                     28:        // value
                     29:        override const char* type() const { return VAMQP_TYPE; }
                     30:        override VStateless_class *get_class() { return amqp_class; }
                     31: 
                     32: #ifdef WITH_AMQP
                     33: public: // usage
                     34:        VAmqp(): fconnection(0), fchannel(0) {}
                     35:        ~VAmqp() {}
                     36: 
                     37:        amqp_connection_state_t fconnection;
                     38:        int fchannel;
                     39:        bool fstop;
                     40: 
                     41:        amqp_connection_state_t connection() {
                     42:                if(!fconnection)
                     43:                        throw Exception(PARSER_RUNTIME, 0, "using uninitialized amqp object");
                     44:                return fconnection;
                     45:        }
                     46: 
                     47:        int channel() {
                     48:                if(!fchannel)
                     49:                        throw Exception(PARSER_RUNTIME, 0, "using uninitialized amqp object channel");
                     50:                return fchannel;
                     51:        }
                     52: 
                     53: #endif // WITH_AMQP
                     54: };
                     55: 
                     56: #endif
                     57: 
                     58: 

E-mail: