Sha256: 39de28405b93786672285ece3bee27a53bd689f26aa689f31fd798e75c8f4ab9

Contents?: true

Size: 1.11 KB

Versions: 18

Compression:

Stored size: 1.11 KB

Contents

#ifndef ENTERPRISE_SCRIPT_SERVICE_DATA_HPP
#define ENTERPRISE_SCRIPT_SERVICE_DATA_HPP

#include <msgpack.hpp>


static const int SYMBOL_EXT_CODE = 0x00;

class symbol {
  std::string name_;

public:
  symbol(std::string name) : name_(name) { };
  const std::string &name() const { return name_; }
};

namespace msgpack {
  MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) {
    namespace adaptor {
      template<>
      struct pack<symbol> {
        template <typename Stream>
        msgpack::packer<Stream> &operator()(msgpack::packer<Stream> &packer, const symbol &s) const {
          auto &name = s.name();
          packer.pack_ext(name.size(), SYMBOL_EXT_CODE);
          packer.pack_ext_body(name.data(), name.size());
          return packer;
        }
      };
    }
  }
}

struct output_stream {
  output_stream(const int fd);
  output_stream &write(const char *, std::size_t);

  const int fd;
};


using out_packer = msgpack::packer<output_stream>;

class data_writer {
public:
  data_writer(out_packer &packer);
  void emit_measurement(std::string key, int64_t value) noexcept;

  out_packer &packer;
};


#endif

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
script_core-0.3.2 ext/enterprise_script_service/data.hpp
script_core-0.3.0 ext/enterprise_script_service/data.hpp
script_core-0.2.7 ext/enterprise_script_service/data.hpp
script_core-0.2.6 ext/enterprise_script_service/data.hpp
script_core-0.2.5 ext/enterprise_script_service/data.hpp
script_core-0.2.4 ext/enterprise_script_service/data.hpp
script_core-0.2.3 ext/enterprise_script_service/data.hpp
script_core-0.2.2 ext/enterprise_script_service/data.hpp
script_core-0.2.1 ext/enterprise_script_service/data.hpp
script_core-0.2.0 ext/enterprise_script_service/data.hpp
script_core-0.1.1 ext/enterprise_script_service/data.hpp
script_core-0.1.0 ext/enterprise_script_service/data.hpp
script_core-0.0.6 ext/enterprise_script_service/data.hpp
script_core-0.0.5 ext/enterprise_script_service/data.hpp
script_core-0.0.4 ext/enterprise_script_service/data.hpp
script_core-0.0.3 ext/enterprise_script_service/data.hpp
script_core-0.0.2 ext/enterprise_script_service/data.hpp
script_core-0.0.1 ext/enterprise_script_service/data.hpp