dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: Help to fill the interface classes

  1. #1
    Join Date
    May 2015
    Posts
    190

    Help to fill the interface classes

    I have the following interface files

    Code:
    class IMask
    {
    public:
    	using value_type = double;
    
    	virtual ~IMask() {}
    
    	// [0, 360) in ascending order
    	// nullptr if no values
    	virtual const value_type* getAngles() const = 0;
    
    	// Loss for each angle (positive dBi value)
    	// nullptr if no values
    	virtual const value_type* getValues() const = 0;
    
    	// May be 0
    	virtual size_t getValueCount() const = 0;
    };
    
    class IAntennaPattern
    {
    public:
    	virtual ~IAntennaPattern() {}
    
    	// Antenna pattern gain (dBi)
    	virtual double getGain() const = 0;
    
    	// Horizontal mask (clockwise, aligned to positive y axis)
    	virtual const IMask* getHorizontalMask() const = 0;
    
    	// Vertical mask
    	virtual const IMask* getVerticalMask() const = 0;
    };
    
    class ITransmitter
    {
    public:
    	// Returns the transmitter's position in meters.
    	virtual const double3& getPosition() const = 0;
    
    	// Returns the transmitter's frequency in MHz.
    	virtual unsigned int getFrequencyMHz() const = 0;
    
    	// Mechanical downtilt in . Positive values => down, negative values => up.
    	// Must not be called when model is unmasked
    	virtual double getTilt() const = 0;
    
    	// Azimuth in  (clockwise, aligned to positive y axis).
    	// Must not be called when model is unmasked
    	virtual double getAzimuth() const = 0;
    
    	// Antenna pattern
    	// Must not be called when model is unmasked
    	virtual const IAntennaPattern* getAntennaPattern() const = 0;
    
    	virtual ~ITransmitter() {}
    };
    I need to give the input in the following format

    Code:
    struct CalculationInput
    {
    	ITransmitter* transmitter;
    	IReceiver*    receiver;
    };
    
    TestFunction
    {
    	velox::propagation_api::CalculationInput input;
    
    	velox::propagation_api::CalculationOutput out;
    	BSTR errorMessage=L"test error message";
    
    	model.calculateGrid(input, out, &errorMessage);
    }
    What is the best way to fill some data for the input.

    Currently I added implementation classes for all the interface classes.like

    Code:
    template <typename T>
    class EmptyMask:velox::propagation_api::IMask
    {
    private:
    	int num_values;
    	T values[100];
    
    public:
    	EmptyMask() { num_values = 0; };
    
    	~EmptyMask() {};
    
    	// [0, 360) in ascending order
    	// nullptr if no values
    	const T* getAngles() const { return 0; };
    
    	// Loss for each angle (positive dBi value)
    	// nullptr if no values
    	const T* getValues() const { return ; };
    
    	// May be 0
    	size_t getValueCount() const { return num_values; };
    };
    Is there any better way. It is quite urgent
    Last edited by 2kaud; September 17th, 2019 at 11:53 AM. Reason: Added code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)