/**
 * Autogenerated by Thrift Compiler (0.9.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
#ifndef ServiceDiscoveryService_H
#define ServiceDiscoveryService_H

#include <thrift/TDispatchProcessor.h>
#include "carreraServiceDiscovery_types.h"

namespace CarreraServiceDiscovery {

class ServiceDiscoveryServiceIf {
 public:
  virtual ~ServiceDiscoveryServiceIf() {}
  virtual void discoverProducerService(ServiceMeta& _return, const std::string& topic, const ClientMeta& meta) = 0;
  virtual void discoverConsumerService(ServiceMeta& _return, const std::string& group, const ClientMeta& meta) = 0;
};

class ServiceDiscoveryServiceIfFactory {
 public:
  typedef ServiceDiscoveryServiceIf Handler;

  virtual ~ServiceDiscoveryServiceIfFactory() {}

  virtual ServiceDiscoveryServiceIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0;
  virtual void releaseHandler(ServiceDiscoveryServiceIf* /* handler */) = 0;
};

class ServiceDiscoveryServiceIfSingletonFactory : virtual public ServiceDiscoveryServiceIfFactory {
 public:
  ServiceDiscoveryServiceIfSingletonFactory(const boost::shared_ptr<ServiceDiscoveryServiceIf>& iface) : iface_(iface) {}
  virtual ~ServiceDiscoveryServiceIfSingletonFactory() {}

  virtual ServiceDiscoveryServiceIf* getHandler(const ::apache::thrift::TConnectionInfo&) {
    return iface_.get();
  }
  virtual void releaseHandler(ServiceDiscoveryServiceIf* /* handler */) {}

 protected:
  boost::shared_ptr<ServiceDiscoveryServiceIf> iface_;
};

class ServiceDiscoveryServiceNull : virtual public ServiceDiscoveryServiceIf {
 public:
  virtual ~ServiceDiscoveryServiceNull() {}
  void discoverProducerService(ServiceMeta& /* _return */, const std::string& /* topic */, const ClientMeta& /* meta */) {
    return;
  }
  void discoverConsumerService(ServiceMeta& /* _return */, const std::string& /* group */, const ClientMeta& /* meta */) {
    return;
  }
};

typedef struct _ServiceDiscoveryService_discoverProducerService_args__isset {
  _ServiceDiscoveryService_discoverProducerService_args__isset() : topic(false), meta(false) {}
  bool topic :1;
  bool meta :1;
} _ServiceDiscoveryService_discoverProducerService_args__isset;

class ServiceDiscoveryService_discoverProducerService_args {
 public:

  static const char* ascii_fingerprint; // = "945012B36126815F4029BFE7DEDBB4CF";
  static const uint8_t binary_fingerprint[16]; // = {0x94,0x50,0x12,0xB3,0x61,0x26,0x81,0x5F,0x40,0x29,0xBF,0xE7,0xDE,0xDB,0xB4,0xCF};

  ServiceDiscoveryService_discoverProducerService_args(const ServiceDiscoveryService_discoverProducerService_args&);
  ServiceDiscoveryService_discoverProducerService_args& operator=(const ServiceDiscoveryService_discoverProducerService_args&);
  ServiceDiscoveryService_discoverProducerService_args() : topic() {
  }

  virtual ~ServiceDiscoveryService_discoverProducerService_args() throw();
  std::string topic;
  ClientMeta meta;

  _ServiceDiscoveryService_discoverProducerService_args__isset __isset;

  void __set_topic(const std::string& val);

  void __set_meta(const ClientMeta& val);

  bool operator == (const ServiceDiscoveryService_discoverProducerService_args & rhs) const
  {
    if (!(topic == rhs.topic))
      return false;
    if (!(meta == rhs.meta))
      return false;
    return true;
  }
  bool operator != (const ServiceDiscoveryService_discoverProducerService_args &rhs) const {
    return !(*this == rhs);
  }

  bool operator < (const ServiceDiscoveryService_discoverProducerService_args &rhs ) const;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

  friend std::ostream& operator<<(std::ostream& out, const ServiceDiscoveryService_discoverProducerService_args& obj);
};


class ServiceDiscoveryService_discoverProducerService_pargs {
 public:

  static const char* ascii_fingerprint; // = "945012B36126815F4029BFE7DEDBB4CF";
  static const uint8_t binary_fingerprint[16]; // = {0x94,0x50,0x12,0xB3,0x61,0x26,0x81,0x5F,0x40,0x29,0xBF,0xE7,0xDE,0xDB,0xB4,0xCF};


  virtual ~ServiceDiscoveryService_discoverProducerService_pargs() throw();
  const std::string* topic;
  const ClientMeta* meta;

  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

  friend std::ostream& operator<<(std::ostream& out, const ServiceDiscoveryService_discoverProducerService_pargs& obj);
};

typedef struct _ServiceDiscoveryService_discoverProducerService_result__isset {
  _ServiceDiscoveryService_discoverProducerService_result__isset() : success(false) {}
  bool success :1;
} _ServiceDiscoveryService_discoverProducerService_result__isset;

class ServiceDiscoveryService_discoverProducerService_result {
 public:

  static const char* ascii_fingerprint; // = "FB9894B8CECCA0A3A1211CF723B85E43";
  static const uint8_t binary_fingerprint[16]; // = {0xFB,0x98,0x94,0xB8,0xCE,0xCC,0xA0,0xA3,0xA1,0x21,0x1C,0xF7,0x23,0xB8,0x5E,0x43};

  ServiceDiscoveryService_discoverProducerService_result(const ServiceDiscoveryService_discoverProducerService_result&);
  ServiceDiscoveryService_discoverProducerService_result& operator=(const ServiceDiscoveryService_discoverProducerService_result&);
  ServiceDiscoveryService_discoverProducerService_result() {
  }

  virtual ~ServiceDiscoveryService_discoverProducerService_result() throw();
  ServiceMeta success;

  _ServiceDiscoveryService_discoverProducerService_result__isset __isset;

  void __set_success(const ServiceMeta& val);

  bool operator == (const ServiceDiscoveryService_discoverProducerService_result & rhs) const
  {
    if (!(success == rhs.success))
      return false;
    return true;
  }
  bool operator != (const ServiceDiscoveryService_discoverProducerService_result &rhs) const {
    return !(*this == rhs);
  }

  bool operator < (const ServiceDiscoveryService_discoverProducerService_result & ) const;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

  friend std::ostream& operator<<(std::ostream& out, const ServiceDiscoveryService_discoverProducerService_result& obj);
};

typedef struct _ServiceDiscoveryService_discoverProducerService_presult__isset {
  _ServiceDiscoveryService_discoverProducerService_presult__isset() : success(false) {}
  bool success :1;
} _ServiceDiscoveryService_discoverProducerService_presult__isset;

class ServiceDiscoveryService_discoverProducerService_presult {
 public:

  static const char* ascii_fingerprint; // = "FB9894B8CECCA0A3A1211CF723B85E43";
  static const uint8_t binary_fingerprint[16]; // = {0xFB,0x98,0x94,0xB8,0xCE,0xCC,0xA0,0xA3,0xA1,0x21,0x1C,0xF7,0x23,0xB8,0x5E,0x43};


  virtual ~ServiceDiscoveryService_discoverProducerService_presult() throw();
  ServiceMeta* success;

  _ServiceDiscoveryService_discoverProducerService_presult__isset __isset;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);

  friend std::ostream& operator<<(std::ostream& out, const ServiceDiscoveryService_discoverProducerService_presult& obj);
};

typedef struct _ServiceDiscoveryService_discoverConsumerService_args__isset {
  _ServiceDiscoveryService_discoverConsumerService_args__isset() : group(false), meta(false) {}
  bool group :1;
  bool meta :1;
} _ServiceDiscoveryService_discoverConsumerService_args__isset;

class ServiceDiscoveryService_discoverConsumerService_args {
 public:

  static const char* ascii_fingerprint; // = "945012B36126815F4029BFE7DEDBB4CF";
  static const uint8_t binary_fingerprint[16]; // = {0x94,0x50,0x12,0xB3,0x61,0x26,0x81,0x5F,0x40,0x29,0xBF,0xE7,0xDE,0xDB,0xB4,0xCF};

  ServiceDiscoveryService_discoverConsumerService_args(const ServiceDiscoveryService_discoverConsumerService_args&);
  ServiceDiscoveryService_discoverConsumerService_args& operator=(const ServiceDiscoveryService_discoverConsumerService_args&);
  ServiceDiscoveryService_discoverConsumerService_args() : group() {
  }

  virtual ~ServiceDiscoveryService_discoverConsumerService_args() throw();
  std::string group;
  ClientMeta meta;

  _ServiceDiscoveryService_discoverConsumerService_args__isset __isset;

  void __set_group(const std::string& val);

  void __set_meta(const ClientMeta& val);

  bool operator == (const ServiceDiscoveryService_discoverConsumerService_args & rhs) const
  {
    if (!(group == rhs.group))
      return false;
    if (!(meta == rhs.meta))
      return false;
    return true;
  }
  bool operator != (const ServiceDiscoveryService_discoverConsumerService_args &rhs) const {
    return !(*this == rhs);
  }

  bool operator < (const ServiceDiscoveryService_discoverConsumerService_args & ) const;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

  friend std::ostream& operator<<(std::ostream& out, const ServiceDiscoveryService_discoverConsumerService_args& obj);
};


class ServiceDiscoveryService_discoverConsumerService_pargs {
 public:

  static const char* ascii_fingerprint; // = "945012B36126815F4029BFE7DEDBB4CF";
  static const uint8_t binary_fingerprint[16]; // = {0x94,0x50,0x12,0xB3,0x61,0x26,0x81,0x5F,0x40,0x29,0xBF,0xE7,0xDE,0xDB,0xB4,0xCF};


  virtual ~ServiceDiscoveryService_discoverConsumerService_pargs() throw();
  const std::string* group;
  const ClientMeta* meta;

  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

  friend std::ostream& operator<<(std::ostream& out, const ServiceDiscoveryService_discoverConsumerService_pargs& obj);
};

typedef struct _ServiceDiscoveryService_discoverConsumerService_result__isset {
  _ServiceDiscoveryService_discoverConsumerService_result__isset() : success(false) {}
  bool success :1;
} _ServiceDiscoveryService_discoverConsumerService_result__isset;

class ServiceDiscoveryService_discoverConsumerService_result {
 public:

  static const char* ascii_fingerprint; // = "FB9894B8CECCA0A3A1211CF723B85E43";
  static const uint8_t binary_fingerprint[16]; // = {0xFB,0x98,0x94,0xB8,0xCE,0xCC,0xA0,0xA3,0xA1,0x21,0x1C,0xF7,0x23,0xB8,0x5E,0x43};

  ServiceDiscoveryService_discoverConsumerService_result(const ServiceDiscoveryService_discoverConsumerService_result&);
  ServiceDiscoveryService_discoverConsumerService_result& operator=(const ServiceDiscoveryService_discoverConsumerService_result&);
  ServiceDiscoveryService_discoverConsumerService_result() {
  }

  virtual ~ServiceDiscoveryService_discoverConsumerService_result() throw();
  ServiceMeta success;

  _ServiceDiscoveryService_discoverConsumerService_result__isset __isset;

  void __set_success(const ServiceMeta& val);

  bool operator == (const ServiceDiscoveryService_discoverConsumerService_result & rhs) const
  {
    if (!(success == rhs.success))
      return false;
    return true;
  }
  bool operator != (const ServiceDiscoveryService_discoverConsumerService_result &rhs) const {
    return !(*this == rhs);
  }

  bool operator < (const ServiceDiscoveryService_discoverConsumerService_result & ) const;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

  friend std::ostream& operator<<(std::ostream& out, const ServiceDiscoveryService_discoverConsumerService_result& obj);
};

typedef struct _ServiceDiscoveryService_discoverConsumerService_presult__isset {
  _ServiceDiscoveryService_discoverConsumerService_presult__isset() : success(false) {}
  bool success :1;
} _ServiceDiscoveryService_discoverConsumerService_presult__isset;

class ServiceDiscoveryService_discoverConsumerService_presult {
 public:

  static const char* ascii_fingerprint; // = "FB9894B8CECCA0A3A1211CF723B85E43";
  static const uint8_t binary_fingerprint[16]; // = {0xFB,0x98,0x94,0xB8,0xCE,0xCC,0xA0,0xA3,0xA1,0x21,0x1C,0xF7,0x23,0xB8,0x5E,0x43};


  virtual ~ServiceDiscoveryService_discoverConsumerService_presult() throw();
  ServiceMeta* success;

  _ServiceDiscoveryService_discoverConsumerService_presult__isset __isset;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);

  friend std::ostream& operator<<(std::ostream& out, const ServiceDiscoveryService_discoverConsumerService_presult& obj);
};

class ServiceDiscoveryServiceClient: virtual public ServiceDiscoveryServiceIf {
 public:
  ServiceDiscoveryServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
    setProtocol(prot);
  }
  ServiceDiscoveryServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
    setProtocol(iprot,oprot);
  }
  virtual ~ServiceDiscoveryServiceClient() {}
 private:
  void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
  setProtocol(prot,prot);
  }
  void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
    piprot_=iprot;
    poprot_=oprot;
    iprot_ = iprot.get();
    oprot_ = oprot.get();
  }
 public:
  boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {
    return piprot_;
  }
  boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {
    return poprot_;
  }
  void discoverProducerService(ServiceMeta& _return, const std::string& topic, const ClientMeta& meta);
  void send_discoverProducerService(const std::string& topic, const ClientMeta& meta);
  void recv_discoverProducerService(ServiceMeta& _return);
  void discoverConsumerService(ServiceMeta& _return, const std::string& group, const ClientMeta& meta);
  void send_discoverConsumerService(const std::string& group, const ClientMeta& meta);
  void recv_discoverConsumerService(ServiceMeta& _return);
 protected:
  boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
  boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
  ::apache::thrift::protocol::TProtocol* iprot_;
  ::apache::thrift::protocol::TProtocol* oprot_;
};

class ServiceDiscoveryServiceProcessor : public ::apache::thrift::TDispatchProcessor {
 protected:
  boost::shared_ptr<ServiceDiscoveryServiceIf> iface_;
  virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext);
 private:
  typedef  void (ServiceDiscoveryServiceProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*);
  typedef std::map<std::string, ProcessFunction> ProcessMap;
  ProcessMap processMap_;
  void process_discoverProducerService(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
  void process_discoverConsumerService(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
 public:
  ServiceDiscoveryServiceProcessor(boost::shared_ptr<ServiceDiscoveryServiceIf> iface) :
    iface_(iface) {
    processMap_["discoverProducerService"] = &ServiceDiscoveryServiceProcessor::process_discoverProducerService;
    processMap_["discoverConsumerService"] = &ServiceDiscoveryServiceProcessor::process_discoverConsumerService;
  }

  virtual ~ServiceDiscoveryServiceProcessor() {}
};

class ServiceDiscoveryServiceProcessorFactory : public ::apache::thrift::TProcessorFactory {
 public:
  ServiceDiscoveryServiceProcessorFactory(const ::boost::shared_ptr< ServiceDiscoveryServiceIfFactory >& handlerFactory) :
      handlerFactory_(handlerFactory) {}

  ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);

 protected:
  ::boost::shared_ptr< ServiceDiscoveryServiceIfFactory > handlerFactory_;
};

class ServiceDiscoveryServiceMultiface : virtual public ServiceDiscoveryServiceIf {
 public:
  ServiceDiscoveryServiceMultiface(std::vector<boost::shared_ptr<ServiceDiscoveryServiceIf> >& ifaces) : ifaces_(ifaces) {
  }
  virtual ~ServiceDiscoveryServiceMultiface() {}
 protected:
  std::vector<boost::shared_ptr<ServiceDiscoveryServiceIf> > ifaces_;
  ServiceDiscoveryServiceMultiface() {}
  void add(boost::shared_ptr<ServiceDiscoveryServiceIf> iface) {
    ifaces_.push_back(iface);
  }
 public:
  void discoverProducerService(ServiceMeta& _return, const std::string& topic, const ClientMeta& meta) {
    size_t sz = ifaces_.size();
    size_t i = 0;
    for (; i < (sz - 1); ++i) {
      ifaces_[i]->discoverProducerService(_return, topic, meta);
    }
    ifaces_[i]->discoverProducerService(_return, topic, meta);
    return;
  }

  void discoverConsumerService(ServiceMeta& _return, const std::string& group, const ClientMeta& meta) {
    size_t sz = ifaces_.size();
    size_t i = 0;
    for (; i < (sz - 1); ++i) {
      ifaces_[i]->discoverConsumerService(_return, group, meta);
    }
    ifaces_[i]->discoverConsumerService(_return, group, meta);
    return;
  }

};

} // namespace

#endif
