Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » FTP class and reference example for U++
Re: FTP class and reference example for U++ [message #47877 is a reply to message #47876] Sat, 15 April 2017 19:38 Go to previous messageGo to previous message
Klugier is currently offline  Klugier
Messages: 932
Registered: September 2012
Location: Poland, Kraków
Experienced Contributor
Hello,

In my opinion handling multi-threading API using #ifdef in header is not good for the end user. Because, he/seh is obligated to use #ifdef in theire code. Personally, i would hide it inside the interface and use One container (Movable will not work for this class).

class Result // Interface - all methods are abstract
{
public:
   // The same as previous

   virtual bool IsAsync() = 0;

   // Mt methods are presented without #ifdef guard
};

class RegularResult : public Result // The name could be different
{
public:
    bool IsAsync() override { return false; }

    // Mt methods returning falses, -1 etc.
};

class AsyncResult : public Result
{
public:
    bool IsAsync() override { return true; }
    
    // Return correct values for MT
};

One<Result> result(new AsyncResult());



What do you think?

Sincerely,
Klugier


Ultimate++ - one framework to rule them all.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Am I doing something wrong, or is there a bug? FIREBIRD
Next Topic: OpenCV and openCV_Demo copiling error
Goto Forum:
  


Current Time: Fri May 27 07:29:54 CEST 2022

Total time taken to generate the page: 0.01537 seconds