Сегодня впервые увидел настоящее метапрограммирование на C++.
Потрясён.
#define IA_PACKAGE_TYPENAME(Number, Name, Version) CIa##Name##Package_v##Version
#define IA_RECORD_MEMBER_DECL(Number, Name, Version) IA_PACKAGE_TYPENAME(Number, Name, Version) *m##Name##Package
//#define IA_PACKAGE_TYPEDEF(Number, Name, Version) typedef CIa##Name##Package CIa##Name##Package_v##Version
#define IA_PACKAGE_TYPEDEF(Number, Name, Version) \
class CIa##Name##Package_v##Version : public CIa##Name##Package \
{ \
public: \
DECLARE_DYNAMIC_CLASS(CIa##Name##Package_v##Version); \
}
#define IA_PACKAGE_TYPEDEF2(Number, Name, NewVersion, BaseVersion) \
class CIa##Name##Package_v##NewVersion : public CIa##Name##Package_v##BaseVersion \
{ \
public: \
DECLARE_DYNAMIC_CLASS(CIa##Name##Package_v##NewVersion); \
}
IA_PACKAGE_TYPEDEF (100, DateTimeDuration, 15);
IA_PACKAGE_TYPEDEF (101, PartnerDirectoryNumber, 15);
IA_PACKAGE_TYPEDEF (102, ServiceInfo, 15);
IA_PACKAGE_TYPEDEF (103, ChargeUnitsForConnection, 15);
IA_PACKAGE_TYPEDEF (104, ChargeUnitsForFau, 15);
IA_PACKAGE_TYPEDEF (105, TrunkIdInc, 15);
IA_PACKAGE_TYPEDEF (106, TrunkIdOutg, 15);
IA_PACKAGE_TYPEDEF (107, TrunkIdIncCic, 15);
IA_PACKAGE_TYPEDEF (108, TrunkIdOutgCic, 15);
IA_PACKAGE_TYPEDEF (110, ConnectionIdentificationNumber, 15);
IA_PACKAGE_TYPEDEF (111, FacilitiesUsedByOwner, 15);
IA_PACKAGE_TYPEDEF (112, FacilitiesUsedByPartner, 15);
IA_PACKAGE_TYPEDEF (113, FacilityInput, 15);
IA_PACKAGE_TYPEDEF (116, DateTime, 15);
IA_PACKAGE_TYPEDEF (118, DigitString, 15);
IA_PACKAGE_TYPEDEF (119, TransmissionMediumRequired, 15);
IA_PACKAGE_TYPEDEF (120, Category, 15);
/*********************************************************************************/
/* PACKAGE 128 (H'80) - NEW DESTINATION */
class CIaNewDestinationPackage_v15 : public CIaPackage
{
public:
IA_PACKAGE(CIaNewDestinationPackage_v15);
virtual unsigned long decodeFromPtr(const unsigned char * inPtr);
public:
CIaBinaryType mPackageLength;
CIaBinaryType mNadi;
CIaBinaryType mNpi;
CIaBinaryType mNoOfDigits;
CIaBcdStringType mDigits;
};
IA_PACKAGE_TYPEDEF (130, TrafficQualityData, 15);
IA_PACKAGE_TYPEDEF (134, DurationsBeforeAnswer, 15);
IA_PACKAGE_TYPEDEF (138, BMeterPulses, 15);
IA_PACKAGE_TYPEDEF (139, ReleaseIndication, 15);
IA_PACKAGE_TYPEDEF (140, IncomingRouteId, 15);
IA_PACKAGE_TYPEDEF (141, OutgoingRouteId, 15);
IA_PACKAGE_TYPEDEF2(142, CallingPartyNumber, 15, 13);
IA_PACKAGE_TYPEDEF (145, CacNumber, 15);
IA_PACKAGE_TYPEDEF2(146, ThirdPartyNumber, 15, 13);
Ссылки по теме: