GenInterfaceAddPrivileges(stream, inf);
GenInterfaceRegister(stream, inf);
GenInterfaceUnregister(stream, inf);
+ GenInterfaceClientNumberGetter(stream, inf);
}
void CStubBodyGen::GenInterfaceMethods(std::ofstream& stream,
}));
}
+void CStubBodyGen::GenInterfaceClientNumberGetter(std::ofstream& stream,
+ const Interface& inf) {
+ stream << SmartIndent(ReplaceAll(CB_INTERFACE_CLIENT_NUMBER_GETTER, "##",
+ GetInterfaceIdWithNamespace(inf)));
+}
+
} // namespace tidl
void GenInterfaceDelegators(std::ofstream& stream, const Interface& inf);
void GenInterfaceContext(std::ofstream& stream, const Interface& inf);
void GenInterfaceAddPrivileges(std::ofstream& stream, const Interface& inf);
+ void GenInterfaceClientNumberGetter(std::ofstream& stream,
+ const Interface& inf);
private:
void GenInterfaceContextDeclaration(std::ofstream& stream,
}
)__c_cb";
+const char CB_INTERFACE_CLIENT_NUMBER_GETTER[] =
+R"__c_cb(
+int rpc_port_stub_##_get_client_number(unsigned int *n)
+{
+ if (!n) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!__##_stub) {
+ _E("## Stub is not ready");
+ return -1;
+ }
+
+ *n = g_list_length(__##_contexts);
+
+ return 0;
+}
+)__c_cb";
+
const char CB_GLOBALS[] =
R"__c_cb(
static rpc_port_stub_h __##_stub;
GenInterfaceDeclaration(stream, inf);
GenInterfaceRegister(stream, inf);
GenInterfaceUnregister(stream, inf);
+ GenInterfaceClientNumberGetter(stream, inf);
}
void CStubHeaderGen::GenInterfaceDeclaration(std::ofstream& stream,
GetInterfaceIdWithNamespace(inf));
}
+void CStubHeaderGen::GenInterfaceClientNumberGetter(std::ofstream& stream,
+ const Interface& inf) {
+ stream << ReplaceAll(CB_INTERFACE_CLIENT_NUMBER_GETTER, "##",
+ GetInterfaceIdWithNamespace(inf));
+}
+
} // namespace tidl
void GenInterfaceDelegators(std::ofstream& stream, const Interface& inf);
void GenInterfaceRegister(std::ofstream& stream, const Interface& inf);
void GenInterfaceUnregister(std::ofstream& stream, const Interface& inf);
+ void GenInterfaceClientNumberGetter(std::ofstream& stream,
+ const Interface& inf);
private:
void GenInterfaceContextDeclaration(std::ofstream& stream,
int rpc_port_stub_##_unregister(void);
)__c_cb";
+const char CB_INTERFACE_CLIENT_NUMBER_GETTER[] =
+R"__c_cb(
+int rpc_port_stub_##_get_client_number(unsigned int *n);
+)__c_cb";
+
#endif // IDLC_C_GEN_C_STUB_HEADER_GEN_CB_H_