You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Andrew Christianson <an...@nextcentury.com> on 2017/05/02 14:33:27 UTC

MiNiFi CPP indentation confusion (Re: MINIFI-244)

Working on merging my code for MINIFI-244 with the latest refactoring where all of the classes have been put into nested namespaces. Looking at sibling files, it looks like several of them are indented with one space. This surprises me. What's the preferred indentation/code style? Two spaces? This would be a first for me if we're actually going for single-space indentation.

Regards,

Andy

Re: MiNiFi CPP indentation confusion (Re: MINIFI-244)

Posted by Andrew Christianson <an...@nextcentury.com>.
Sounds good, thanks.
________________________________________
From: Marc P. <ma...@gmail.com>
Sent: Tuesday, May 2, 2017 11:12:02 AM
To: dev@nifi.apache.org
Subject: Re: MiNiFi CPP indentation confusion (Re: MINIFI-244)

Andy,
  That will be solved with MINIFI-226. You will only need to call
  REGISTER_RESOURCE(classname) or REGISTER_RESOURCE_AS(classname,name) in
your header file and it will automatically be loadable via the name.

  You are correct though, we can alias the namespace ( and we do in
core/Core.h). Feel free to create a processors namespace alias.

On Tue, May 2, 2017 at 10:59 AM, Andrew Christianson <
andrew.christianson@nextcentury.com> wrote:

> OK, I can work with that. Does the style guide allow for cleaning up this
> bit?
>
>   if (name
>       == org::apache::nifi::minifi::processors::GenerateFlowFile::ProcessorName)
> {
>     processor = std::make_shared<
>         org::apache::nifi::minifi::processors::GenerateFlowFile>(name,
> uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::LogAttribute::ProcessorName)
> {
>     processor = std::make_shared<
>         org::apache::nifi::minifi::processors::LogAttribute>(name, uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::GetFile::ProcessorName) {
>     processor =
>         std::make_shared<org::apache::nifi::minifi::processors::
> GetFile>(name,
>
>  uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::PutFile::ProcessorName) {
>     processor =
>         std::make_shared<org::apache::nifi::minifi::processors::
> PutFile>(name,
>
>  uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::TailFile::ProcessorName) {
>     processor =
>         std::make_shared<org::apache::nifi::minifi::processors::
> TailFile>(name,
>
> uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::ListenSyslog::ProcessorName)
> {
>     processor = std::make_shared<
>         org::apache::nifi::minifi::processors::ListenSyslog>(name, uuid);
>   } else if (name
>         == org::apache::nifi::minifi::processors::ListenHTTP::ProcessorName)
> {
>       processor = std::make_shared<
>           org::apache::nifi::minifi::processors::ListenHTTP>(name, uuid);
>   } else if (name
>           == org::apache::nifi::minifi::processors::InvokeHTTP::ProcessorName)
> {
>         processor = std::make_shared<
>             org::apache::nifi::minifi::processors::InvokeHTTP>(name,
> uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::ExecuteProcess::ProcessorName)
> {
>     processor = std::make_shared<
>         org::apache::nifi::minifi::processors::ExecuteProcess>(name,
> uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::AppendHostInfo::ProcessorName)
> {
>     processor = std::make_shared<
>         org::apache::nifi::minifi::processors::AppendHostInfo>(name,
> uuid);
>   } else {
>     logger_->log_error("No Processor defined for %s", name.c_str());
>     return nullptr;
>   }
>
> It seems very excessive to continually repeat org::apache::nifi::minifi::processors.
> It looks like the style guide may allow something like this?
>
> namespace processors = org::apache::nifi::minifi::processors;
>
> Is that correct?
>
> -Andy
> ________________________________________
> From: Kevin Doran <kd...@gmail.com>
> Sent: Tuesday, May 2, 2017 10:49:25 AM
> To: dev@nifi.apache.org
> Subject: Re: MiNiFi CPP indentation confusion (Re: MINIFI-244)
>
> Hi Andy,
>
> I’ll let a minify-cpp veteran jump in if I have this wrong, but I believe
> we are following the Google C++ Style Guide [1]. As it is my first time
> following this style, it caused me to do a double take as well :-)
>
> The Google C++ Style Guide does specify entries under public, protected,
> and private sections are indented one space [2]
>
> [1] https://google.github.io/styleguide/cppguide.html
> [2] https://google.github.io/styleguide/cppguide.html#Class_Format
>
> -- Kevin
>
> On 5/2/17, 10:35, "Andrew Christianson" <andrew.christianson@
> nextcentury.com> wrote:
>
>     On closer inspection, it looks like just the public/private/etc.
> specifiers are single-space indented, with the rest being two-spaces. Is
> this intentional?
>     ________________________________________
>     From: Andrew Christianson
>     Sent: Tuesday, May 2, 2017 10:33:27 AM
>     To: dev@nifi.apache.org
>     Subject: MiNiFi CPP indentation confusion (Re: MINIFI-244)
>
>     Working on merging my code for MINIFI-244 with the latest refactoring
> where all of the classes have been put into nested namespaces. Looking at
> sibling files, it looks like several of them are indented with one space.
> This surprises me. What's the preferred indentation/code style? Two spaces?
> This would be a first for me if we're actually going for single-space
> indentation.
>
>     Regards,
>
>     Andy
>
>
>
>

Re: MiNiFi CPP indentation confusion (Re: MINIFI-244)

Posted by "Marc P." <ma...@gmail.com>.
Andy,
  That will be solved with MINIFI-226. You will only need to call
  REGISTER_RESOURCE(classname) or REGISTER_RESOURCE_AS(classname,name) in
your header file and it will automatically be loadable via the name.

  You are correct though, we can alias the namespace ( and we do in
core/Core.h). Feel free to create a processors namespace alias.

On Tue, May 2, 2017 at 10:59 AM, Andrew Christianson <
andrew.christianson@nextcentury.com> wrote:

> OK, I can work with that. Does the style guide allow for cleaning up this
> bit?
>
>   if (name
>       == org::apache::nifi::minifi::processors::GenerateFlowFile::ProcessorName)
> {
>     processor = std::make_shared<
>         org::apache::nifi::minifi::processors::GenerateFlowFile>(name,
> uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::LogAttribute::ProcessorName)
> {
>     processor = std::make_shared<
>         org::apache::nifi::minifi::processors::LogAttribute>(name, uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::GetFile::ProcessorName) {
>     processor =
>         std::make_shared<org::apache::nifi::minifi::processors::
> GetFile>(name,
>
>  uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::PutFile::ProcessorName) {
>     processor =
>         std::make_shared<org::apache::nifi::minifi::processors::
> PutFile>(name,
>
>  uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::TailFile::ProcessorName) {
>     processor =
>         std::make_shared<org::apache::nifi::minifi::processors::
> TailFile>(name,
>
> uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::ListenSyslog::ProcessorName)
> {
>     processor = std::make_shared<
>         org::apache::nifi::minifi::processors::ListenSyslog>(name, uuid);
>   } else if (name
>         == org::apache::nifi::minifi::processors::ListenHTTP::ProcessorName)
> {
>       processor = std::make_shared<
>           org::apache::nifi::minifi::processors::ListenHTTP>(name, uuid);
>   } else if (name
>           == org::apache::nifi::minifi::processors::InvokeHTTP::ProcessorName)
> {
>         processor = std::make_shared<
>             org::apache::nifi::minifi::processors::InvokeHTTP>(name,
> uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::ExecuteProcess::ProcessorName)
> {
>     processor = std::make_shared<
>         org::apache::nifi::minifi::processors::ExecuteProcess>(name,
> uuid);
>   } else if (name
>       == org::apache::nifi::minifi::processors::AppendHostInfo::ProcessorName)
> {
>     processor = std::make_shared<
>         org::apache::nifi::minifi::processors::AppendHostInfo>(name,
> uuid);
>   } else {
>     logger_->log_error("No Processor defined for %s", name.c_str());
>     return nullptr;
>   }
>
> It seems very excessive to continually repeat org::apache::nifi::minifi::processors.
> It looks like the style guide may allow something like this?
>
> namespace processors = org::apache::nifi::minifi::processors;
>
> Is that correct?
>
> -Andy
> ________________________________________
> From: Kevin Doran <kd...@gmail.com>
> Sent: Tuesday, May 2, 2017 10:49:25 AM
> To: dev@nifi.apache.org
> Subject: Re: MiNiFi CPP indentation confusion (Re: MINIFI-244)
>
> Hi Andy,
>
> I’ll let a minify-cpp veteran jump in if I have this wrong, but I believe
> we are following the Google C++ Style Guide [1]. As it is my first time
> following this style, it caused me to do a double take as well :-)
>
> The Google C++ Style Guide does specify entries under public, protected,
> and private sections are indented one space [2]
>
> [1] https://google.github.io/styleguide/cppguide.html
> [2] https://google.github.io/styleguide/cppguide.html#Class_Format
>
> -- Kevin
>
> On 5/2/17, 10:35, "Andrew Christianson" <andrew.christianson@
> nextcentury.com> wrote:
>
>     On closer inspection, it looks like just the public/private/etc.
> specifiers are single-space indented, with the rest being two-spaces. Is
> this intentional?
>     ________________________________________
>     From: Andrew Christianson
>     Sent: Tuesday, May 2, 2017 10:33:27 AM
>     To: dev@nifi.apache.org
>     Subject: MiNiFi CPP indentation confusion (Re: MINIFI-244)
>
>     Working on merging my code for MINIFI-244 with the latest refactoring
> where all of the classes have been put into nested namespaces. Looking at
> sibling files, it looks like several of them are indented with one space.
> This surprises me. What's the preferred indentation/code style? Two spaces?
> This would be a first for me if we're actually going for single-space
> indentation.
>
>     Regards,
>
>     Andy
>
>
>
>

Re: MiNiFi CPP indentation confusion (Re: MINIFI-244)

Posted by Andrew Christianson <an...@nextcentury.com>.
OK, I can work with that. Does the style guide allow for cleaning up this bit?

  if (name
      == org::apache::nifi::minifi::processors::GenerateFlowFile::ProcessorName) {
    processor = std::make_shared<
        org::apache::nifi::minifi::processors::GenerateFlowFile>(name, uuid);
  } else if (name
      == org::apache::nifi::minifi::processors::LogAttribute::ProcessorName) {
    processor = std::make_shared<
        org::apache::nifi::minifi::processors::LogAttribute>(name, uuid);
  } else if (name
      == org::apache::nifi::minifi::processors::GetFile::ProcessorName) {
    processor =
        std::make_shared<org::apache::nifi::minifi::processors::GetFile>(name,
                                                                         uuid);
  } else if (name
      == org::apache::nifi::minifi::processors::PutFile::ProcessorName) {
    processor =
        std::make_shared<org::apache::nifi::minifi::processors::PutFile>(name,
                                                                         uuid);
  } else if (name
      == org::apache::nifi::minifi::processors::TailFile::ProcessorName) {
    processor =
        std::make_shared<org::apache::nifi::minifi::processors::TailFile>(name,
                                                                          uuid);
  } else if (name
      == org::apache::nifi::minifi::processors::ListenSyslog::ProcessorName) {
    processor = std::make_shared<
        org::apache::nifi::minifi::processors::ListenSyslog>(name, uuid);
  } else if (name
        == org::apache::nifi::minifi::processors::ListenHTTP::ProcessorName) {
      processor = std::make_shared<
          org::apache::nifi::minifi::processors::ListenHTTP>(name, uuid);
  } else if (name
          == org::apache::nifi::minifi::processors::InvokeHTTP::ProcessorName) {
        processor = std::make_shared<
            org::apache::nifi::minifi::processors::InvokeHTTP>(name, uuid);
  } else if (name
      == org::apache::nifi::minifi::processors::ExecuteProcess::ProcessorName) {
    processor = std::make_shared<
        org::apache::nifi::minifi::processors::ExecuteProcess>(name, uuid);
  } else if (name
      == org::apache::nifi::minifi::processors::AppendHostInfo::ProcessorName) {
    processor = std::make_shared<
        org::apache::nifi::minifi::processors::AppendHostInfo>(name, uuid);
  } else {
    logger_->log_error("No Processor defined for %s", name.c_str());
    return nullptr;
  }

It seems very excessive to continually repeat org::apache::nifi::minifi::processors. It looks like the style guide may allow something like this?

namespace processors = org::apache::nifi::minifi::processors;

Is that correct?

-Andy
________________________________________
From: Kevin Doran <kd...@gmail.com>
Sent: Tuesday, May 2, 2017 10:49:25 AM
To: dev@nifi.apache.org
Subject: Re: MiNiFi CPP indentation confusion (Re: MINIFI-244)

Hi Andy,

I’ll let a minify-cpp veteran jump in if I have this wrong, but I believe we are following the Google C++ Style Guide [1]. As it is my first time following this style, it caused me to do a double take as well :-)

The Google C++ Style Guide does specify entries under public, protected, and private sections are indented one space [2]

[1] https://google.github.io/styleguide/cppguide.html
[2] https://google.github.io/styleguide/cppguide.html#Class_Format

-- Kevin

On 5/2/17, 10:35, "Andrew Christianson" <an...@nextcentury.com> wrote:

    On closer inspection, it looks like just the public/private/etc. specifiers are single-space indented, with the rest being two-spaces. Is this intentional?
    ________________________________________
    From: Andrew Christianson
    Sent: Tuesday, May 2, 2017 10:33:27 AM
    To: dev@nifi.apache.org
    Subject: MiNiFi CPP indentation confusion (Re: MINIFI-244)

    Working on merging my code for MINIFI-244 with the latest refactoring where all of the classes have been put into nested namespaces. Looking at sibling files, it looks like several of them are indented with one space. This surprises me. What's the preferred indentation/code style? Two spaces? This would be a first for me if we're actually going for single-space indentation.

    Regards,

    Andy




Re: MiNiFi CPP indentation confusion (Re: MINIFI-244)

Posted by Kevin Doran <kd...@gmail.com>.
Hi Andy,

I’ll let a minify-cpp veteran jump in if I have this wrong, but I believe we are following the Google C++ Style Guide [1]. As it is my first time following this style, it caused me to do a double take as well :-)

The Google C++ Style Guide does specify entries under public, protected, and private sections are indented one space [2]

[1] https://google.github.io/styleguide/cppguide.html
[2] https://google.github.io/styleguide/cppguide.html#Class_Format 

-- Kevin

On 5/2/17, 10:35, "Andrew Christianson" <an...@nextcentury.com> wrote:

    On closer inspection, it looks like just the public/private/etc. specifiers are single-space indented, with the rest being two-spaces. Is this intentional?
    ________________________________________
    From: Andrew Christianson
    Sent: Tuesday, May 2, 2017 10:33:27 AM
    To: dev@nifi.apache.org
    Subject: MiNiFi CPP indentation confusion (Re: MINIFI-244)
    
    Working on merging my code for MINIFI-244 with the latest refactoring where all of the classes have been put into nested namespaces. Looking at sibling files, it looks like several of them are indented with one space. This surprises me. What's the preferred indentation/code style? Two spaces? This would be a first for me if we're actually going for single-space indentation.
    
    Regards,
    
    Andy
    



Re: MiNiFi CPP indentation confusion (Re: MINIFI-244)

Posted by Andrew Christianson <an...@nextcentury.com>.
On closer inspection, it looks like just the public/private/etc. specifiers are single-space indented, with the rest being two-spaces. Is this intentional?
________________________________________
From: Andrew Christianson
Sent: Tuesday, May 2, 2017 10:33:27 AM
To: dev@nifi.apache.org
Subject: MiNiFi CPP indentation confusion (Re: MINIFI-244)

Working on merging my code for MINIFI-244 with the latest refactoring where all of the classes have been put into nested namespaces. Looking at sibling files, it looks like several of them are indented with one space. This surprises me. What's the preferred indentation/code style? Two spaces? This would be a first for me if we're actually going for single-space indentation.

Regards,

Andy