Experimental integration Glean with Unity applications

Image
You might notice  Firefox Reality PC Preview  has been released in HTC’s Viveport store. That is a VR web browser that provides 2D overlay browsing alongside immersive content and supports web-based immersive experiences for PC-connected VR headsets. In order to easily deploy our product into the Viveport store, we take advantage of Unity to help make our application launcher. Also because of that, it brings us another challenge about how to use Mozilla’s existing telemetry system. As we know,  Glean SDK  has provided language bindings for different programming language requirements that include Kotlin, Swift, and Python. However, when we are talking about supporting applications that use Unity as their development toolkit, there are no existing bindings available to help us achieve it. Unity allows users using a Python interpreter to embed Python scripts in a Unity project; however, due to Unity’s technology being based on the Mono framework, that is not the same as our familiar Pytho

Template in .cpp file

- Compiler uses template classes to create types by substituting template parameters, and this process is called instantiation.

- The type that is created from a template class is called a  specialization.
  
//---------------------------------------------------------------
// in main.cpp
#include "temp.h"

int main()
{
    Foo A;

    Foo B = A;
   

    return 0;
}


// in temp.h
template < typename T>
class  Foo
{
public:
    Foo() ;
    ~Foo() ;

    Foo( Foo &rhs )
    {
        int test = 0 ;
    };
};

#include "temp.cpp"

template < typename T>
Foo::Foo()
{
   int test = 0;
}

template < typename T>
Foo::~Foo()
{
    int test = 0;
}

 
template class Foo ; // explicit instantiation   
//--------------------------------------------------------------- 


With this approach, we don't have huge headers, and hence the build time will drop. Also, the header files will be "cleaner" and more readable. However, we don't have the benefits of lazy instantiation here (explicit instantiation generates the code for all member functions)

reference: http://www.codeproject.com/KB/cpp/templatesourceorg.aspx

Comments

Popular posts from this blog

tex2D vs. tex2Dproj

Fast subsurface scattering

Bringing Large Scale Console Game to iOS