You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Simon South (JIRA)" <ji...@apache.org> on 2015/08/18 14:32:46 UTC

[jira] [Commented] (THRIFT-3297) c_glib: an abstract base class is not generated

    [ https://issues.apache.org/jira/browse/THRIFT-3297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14701184#comment-14701184 ] 

Simon South commented on THRIFT-3297:
-------------------------------------

Support for servers in C (GLib) was [added in Thrift 0.9.2|https://issues.apache.org/jira/browse/THRIFT-2709].

I recommend [building|http://thrift.apache.org/docs/BuildingFromSource] the latest version of Thrift yourself from [the source in git|http://thrift.apache.org/developers], which includes a number of recent, significant improvements to the C implementation.

> c_glib: an abstract base class is not generated
> -----------------------------------------------
>
>                 Key: THRIFT-3297
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3297
>             Project: Thrift
>          Issue Type: Bug
>          Components: C glib - Compiler
>    Affects Versions: 0.9.1
>            Reporter: Pavel Paulau
>
> The tutorial says:
> {quote}
> For each service the Thrift compiler generates an abstract base
>    class from which handler implementations should inherit. In our
>    case TutorialCalculatorHandler inherits from CalculatorHandler,
>    defined in gen-c_glib/calculator.h.
> {quote}
> However, when I run
> {code}
> thrift -r --gen c_glib tutorial.thrift
> {code}
> I get:
> {code}
> /**
>  * Autogenerated by Thrift Compiler (0.9.1)
>  *
>  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
>  *  @generated
>  */
> #ifndef CALCULATOR_H
> #define CALCULATOR_H
> #include "tutorial_types.h"
> #include "shared_service.h"
> /* Calculator service interface */
> typedef struct _CalculatorIf CalculatorIf;  /* dummy object */
> struct _CalculatorIfInterface
> {
>   GTypeInterface parent;
>   gboolean (*ping) (CalculatorIf *iface, GError **error);
>   gboolean (*add) (CalculatorIf *iface, gint32* _return, const gint32 num1, const gint32 num2, GError **error);
>   gboolean (*calculate) (CalculatorIf *iface, gint32* _return, const gint32 logid, const Work * w, InvalidOperation ** ouch, GError **error);
>   gboolean (*zip) (CalculatorIf *iface, GError **error);
> };
> typedef struct _CalculatorIfInterface CalculatorIfInterface;
> GType calculator_if_get_type (void);
> #define TYPE_CALCULATOR_IF (calculator_if_get_type())
> #define CALCULATOR_IF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CALCULATOR_IF, CalculatorIf))
> #define IS_CALCULATOR_IF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CALCULATOR_IF))
> #define CALCULATOR_IF_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), TYPE_CALCULATOR_IF, CalculatorIfInterface))
> gboolean calculator_if_ping (CalculatorIf *iface, GError **error);
> gboolean calculator_if_add (CalculatorIf *iface, gint32* _return, const gint32 num1, const gint32 num2, GError **error);
> gboolean calculator_if_calculate (CalculatorIf *iface, gint32* _return, const gint32 logid, const Work * w, InvalidOperation ** ouch, GError **error);
> gboolean calculator_if_zip (CalculatorIf *iface, GError **error);
> /* Calculator service client */
> struct _CalculatorClient
> {
>   GObject parent;
>   ThriftProtocol *input_protocol;
>   ThriftProtocol *output_protocol;
> };
> typedef struct _CalculatorClient CalculatorClient;
> struct _CalculatorClientClass
> {
>   GObjectClass parent;
> };
> typedef struct _CalculatorClientClass CalculatorClientClass;
> GType calculator_client_get_type (void);
> #define TYPE_CALCULATOR_CLIENT (calculator_client_get_type())
> #define CALCULATOR_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CALCULATOR_CLIENT, CalculatorClient))
> #define CALCULATOR_CLIENT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), TYPE_CALCULATOR_CLIENT, CalculatorClientClass))
> #define CALCULATOR_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CALCULATOR_CLIENT))
> #define CALCULATOR_IS_CLIENT_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), TYPE_CALCULATOR_CLIENT))
> #define CALCULATOR_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CALCULATOR_CLIENT, CalculatorClientClass))
> gboolean calculator_client_ping (CalculatorIf * iface, GError ** error);
> gboolean calculator_client_send_ping (CalculatorIf * iface, GError ** error);
> gboolean calculator_client_recv_ping (CalculatorIf * iface, GError ** error);
> gboolean calculator_client_add (CalculatorIf * iface, gint32* _return, const gint32 num1, const gint32 num2, GError ** error);
> gboolean calculator_client_send_add (CalculatorIf * iface, const gint32 num1, const gint32 num2, GError ** error);
> gboolean calculator_client_recv_add (CalculatorIf * iface, gint32* _return, GError ** error);
> gboolean calculator_client_calculate (CalculatorIf * iface, gint32* _return, const gint32 logid, const Work * w, InvalidOperation ** ouch, GError ** error);
> gboolean calculator_client_send_calculate (CalculatorIf * iface, const gint32 logid, const Work * w, GError ** error);
> gboolean calculator_client_recv_calculate (CalculatorIf * iface, gint32* _return, InvalidOperation ** ouch, GError ** error);
> gboolean calculator_client_zip (CalculatorIf * iface, GError ** error);
> gboolean calculator_client_send_zip (CalculatorIf * iface, GError ** error);
> void calculator_client_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
> void calculator_client_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
> #endif /* CALCULATOR_H */
> {code}
> There is no definition in other files either:
> {code}
> $ grep -iR handler gen-c_glib
> $
> {code}
> What am I missing?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)