B
    áÉ’\«
  ã               @   s\   d dl Z G dd„ deƒZdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Z	dd„ Z
dS )é    Nc               @   sV   e Zd ZdgZedd„ ƒZdd„ Zdd„ Zdd	„ Zd
d„ Z	dd„ Z
dd„ Zdd„ ZdS )ÚSampleÚ_tabc             C   s.   t j t jj||¡}tƒ }| ||| ¡ |S )N)ÚflatbuffersÚencodeÚGetÚpackerÚuoffsetr   ÚInit)ÚclsÚbufÚoffsetÚnÚx© r   úU/global/project/projectdirs/dasrepo/etalumis/pyprob_master_mar20/pyprob/ppx/Sample.pyÚGetRootAsSample
   s    zSample.GetRootAsSamplec             C   s   t j ||¡| _d S )N)r   ÚtableÚTabler   )Úselfr   Úposr   r   r   r	      s    zSample.Initc             C   s6   t jj | j d¡¡}|dkr2| j || jj ¡S d S )Né   r   )r   Únumber_typesÚUOffsetTFlagsÚpy_typer   ÚOffsetÚStringÚPos)r   Úor   r   r   ÚAddress   s    zSample.Addressc             C   s6   t jj | j d¡¡}|dkr2| j || jj ¡S d S )Né   r   )r   r   r   r   r   r   r   r   )r   r   r   r   r   ÚName   s    zSample.Namec             C   s<   t jj | j d¡¡}|dkr8| j t jj|| jj ¡S dS )Né   r   )	r   r   r   r   r   r   r   Ú
Uint8Flagsr   )r   r   r   r   r   ÚDistributionType$   s    zSample.DistributionTypec             C   sL   t jj | j d¡¡}|dkrHddlm} |tƒ dƒ}| j 	||¡ |S d S )Né
   r   )r   )
r   r   r   r   r   r   Úflatbuffers.tabler   Ú	bytearrayÚUnion)r   r   r   Úobjr   r   r   ÚDistribution+   s    zSample.Distributionc             C   s@   t jj | j d¡¡}|dkr<t| j t jj|| jj	 ¡ƒS dS )Né   r   T)
r   r   r   r   r   r   Úboolr   Ú	BoolFlagsr   )r   r   r   r   r   ÚControl5   s    zSample.Controlc             C   s@   t jj | j d¡¡}|dkr<t| j t jj|| jj	 ¡ƒS dS )Né   r   F)
r   r   r   r   r   r   r+   r   r,   r   )r   r   r   r   r   ÚReplace<   s    zSample.ReplaceN)Ú__name__Ú
__module__Ú__qualname__Ú	__slots__Úclassmethodr   r	   r   r    r#   r)   r-   r/   r   r   r   r   r      s   
r   c             C   s   |   d¡ d S )Nr   )ÚStartObject)Úbuilderr   r   r   ÚSampleStartB   s    r7   c             C   s   |   dtjj |¡d¡ d S )Nr   )ÚPrependUOffsetTRelativeSlotr   r   r   r   )r6   Úaddressr   r   r   ÚSampleAddAddressC   s    r:   c             C   s   |   dtjj |¡d¡ d S )Né   r   )r8   r   r   r   r   )r6   Únamer   r   r   ÚSampleAddNameD   s    r=   c             C   s   |   d|d¡ d S )Né   r   )ÚPrependUint8Slot)r6   ZdistributionTyper   r   r   ÚSampleAddDistributionTypeE   s    r@   c             C   s   |   dtjj |¡d¡ d S )Né   r   )r8   r   r   r   r   )r6   Údistributionr   r   r   ÚSampleAddDistributionF   s    rC   c             C   s   |   d|d¡ d S )Nr   r;   )ÚPrependBoolSlot)r6   Úcontrolr   r   r   ÚSampleAddControlG   s    rF   c             C   s   |   d|d¡ d S )Né   r   )rD   )r6   Úreplacer   r   r   ÚSampleAddReplaceH   s    rI   c             C   s   |   ¡ S )N)Ú	EndObject)r6   r   r   r   Ú	SampleEndI   s    rK   )r   Úobjectr   r7   r:   r=   r@   rC   rF   rI   rK   r   r   r   r   Ú<module>   s   ;