Example #1
0
/* initializes the class */
static void
thrift_memory_buffer_class_init (ThriftMemoryBufferClass *cls)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
  GParamSpec *param_spec = NULL;

  /* setup accessors and mutators */
  gobject_class->get_property = thrift_memory_buffer_get_property;
  gobject_class->set_property = thrift_memory_buffer_set_property;

  param_spec = g_param_spec_uint ("buf_size",
                                  "buffer size (construct)",
                                  "Set the read buffer size",
                                  0, /* min */
                                  1048576, /* max, 1024*1024 */
                                  512, /* default value */
                                  G_PARAM_CONSTRUCT_ONLY |
                                  G_PARAM_READWRITE);
  g_object_class_install_property (gobject_class,
                                   PROP_THRIFT_MEMORY_BUFFER_BUFFER_SIZE,
                                   param_spec);

  ThriftTransportClass *ttc = THRIFT_TRANSPORT_CLASS (cls);

  gobject_class->finalize = thrift_memory_buffer_finalize;
  ttc->is_open = thrift_memory_buffer_is_open;
  ttc->open = thrift_memory_buffer_open;
  ttc->close = thrift_memory_buffer_close;
  ttc->read = thrift_memory_buffer_read;
  ttc->read_end = thrift_memory_buffer_read_end;
  ttc->write = thrift_memory_buffer_write;
  ttc->write_end = thrift_memory_buffer_write_end;
  ttc->flush = thrift_memory_buffer_flush;
}
Example #2
0
/* initializes the class */
static void
thrift_memory_buffer_class_init (ThriftMemoryBufferClass *cls)
{
  ThriftTransportClass *ttc = THRIFT_TRANSPORT_CLASS (cls);
  GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
  GParamSpec *param_spec = NULL;

  /* setup accessors and mutators */
  gobject_class->get_property = thrift_memory_buffer_get_property;
  gobject_class->set_property = thrift_memory_buffer_set_property;

  param_spec = g_param_spec_uint ("buf_size",
                                  "buffer size (construct)",
                                  "Set the read/write buffer size limit",
                                  0, /* min */
                                  G_MAXUINT32, /* max */
                                  G_MAXUINT32, /* default */
                                  G_PARAM_CONSTRUCT_ONLY |
                                  G_PARAM_READWRITE);
  g_object_class_install_property (gobject_class,
                                   PROP_THRIFT_MEMORY_BUFFER_BUFFER_SIZE,
                                   param_spec);

  param_spec = g_param_spec_pointer ("buf",
                                     "internal buffer (GByteArray)",
                                     "Set the internal buffer (GByteArray)",
                                     G_PARAM_CONSTRUCT_ONLY |
                                     G_PARAM_READWRITE);
  g_object_class_install_property (gobject_class,
                                   PROP_THRIFT_MEMORY_BUFFER_BUFFER,
                                   param_spec);

  param_spec = g_param_spec_boolean ("owner",
                                     "internal buffer memory management policy",
                                     "Set whether internal buffer should be"
                                       " unreferenced when thrift_memory_buffer"
                                       " is finalized",
                                     TRUE,
                                     G_PARAM_CONSTRUCT_ONLY |
                                     G_PARAM_READWRITE);
  g_object_class_install_property (gobject_class,
                                   PROP_THRIFT_MEMORY_BUFFER_OWNER,
                                   param_spec);

  gobject_class->constructed = thrift_memory_buffer_constructed;
  gobject_class->finalize = thrift_memory_buffer_finalize;
  ttc->is_open = thrift_memory_buffer_is_open;
  ttc->open = thrift_memory_buffer_open;
  ttc->close = thrift_memory_buffer_close;
  ttc->read = thrift_memory_buffer_read;
  ttc->read_end = thrift_memory_buffer_read_end;
  ttc->write = thrift_memory_buffer_write;
  ttc->write_end = thrift_memory_buffer_write_end;
  ttc->flush = thrift_memory_buffer_flush;
}
/* initializes the class */
static void
thrift_framed_transport_class_init (ThriftFramedTransportClass *cls)
{
    GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
    GParamSpec *param_spec = NULL;

    /* setup accessors and mutators */
    gobject_class->get_property = thrift_framed_transport_get_property;
    gobject_class->set_property = thrift_framed_transport_set_property;

    param_spec = g_param_spec_object ("transport", "transport (construct)",
                                      "Thrift transport",
                                      THRIFT_TYPE_TRANSPORT,
                                      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
    g_object_class_install_property (gobject_class,
                                     PROP_THRIFT_FRAMED_TRANSPORT_TRANSPORT,
                                     param_spec);

    param_spec = g_param_spec_uint ("r_buf_size",
                                    "read buffer size (construct)",
                                    "Set the read buffer size",
                                    0, /* min */
                                    1048576, /* max, 1024*1024 */
                                    512, /* default value */
                                    G_PARAM_CONSTRUCT_ONLY |
                                    G_PARAM_READWRITE);
    g_object_class_install_property (gobject_class,
                                     PROP_THRIFT_FRAMED_TRANSPORT_READ_BUFFER_SIZE,
                                     param_spec);

    param_spec = g_param_spec_uint ("w_buf_size",
                                    "write buffer size (construct)",
                                    "Set the write buffer size",
                                    0, /* min */
                                    1048576, /* max, 1024*1024 */
                                    512, /* default value */
                                    G_PARAM_CONSTRUCT_ONLY |
                                    G_PARAM_READWRITE);
    g_object_class_install_property (gobject_class,
                                     PROP_THRIFT_FRAMED_TRANSPORT_WRITE_BUFFER_SIZE,
                                     param_spec);


    ThriftTransportClass *ttc = THRIFT_TRANSPORT_CLASS (cls);

    gobject_class->finalize = thrift_framed_transport_finalize;
    ttc->is_open = thrift_framed_transport_is_open;
    ttc->open = thrift_framed_transport_open;
    ttc->close = thrift_framed_transport_close;
    ttc->read = thrift_framed_transport_read;
    ttc->read_end = thrift_framed_transport_read_end;
    ttc->write = thrift_framed_transport_write;
    ttc->write_end = thrift_framed_transport_write_end;
    ttc->flush = thrift_framed_transport_flush;
}
Example #4
0
/* initializes the class */
static void
thrift_socket_class_init (ThriftSocketClass *cls)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
  GParamSpec *param_spec = NULL;

  /* setup accessors and mutators */
  gobject_class->get_property = thrift_socket_get_property;
  gobject_class->set_property = thrift_socket_set_property;

  param_spec = g_param_spec_string ("hostname",
                                    "hostname (construct)",
                                    "Set the hostname of the remote host",
                                    "localhost", /* default value */
                                    G_PARAM_CONSTRUCT_ONLY |
                                    G_PARAM_READWRITE);
  g_object_class_install_property (gobject_class, PROP_THRIFT_SOCKET_HOSTNAME, 
                                   param_spec);

  param_spec = g_param_spec_uint ("port",
                                  "port (construct)",
                                  "Set the port of the remote host",
                                  0, /* min */
                                  65534, /* max */
                                  9090, /* default by convention */
                                  G_PARAM_CONSTRUCT_ONLY |
                                  G_PARAM_READWRITE);
  g_object_class_install_property (gobject_class, PROP_THRIFT_SOCKET_PORT, 
                                   param_spec);

  ThriftTransportClass *ttc = THRIFT_TRANSPORT_CLASS (cls);

  gobject_class->finalize = thrift_socket_finalize;
  ttc->is_open = thrift_socket_is_open;
  ttc->open = thrift_socket_open;
  ttc->close = thrift_socket_close;
  ttc->read = thrift_socket_read;
  ttc->read_end = thrift_socket_read_end;
  ttc->write = thrift_socket_write;
  ttc->write_end = thrift_socket_write_end;
  ttc->flush = thrift_socket_flush;
}