Update headers, fix style for some py files
[alexxy/gromacs.git] / src / python / sip / topology / atoms.sip
index a67038a2e5d666cbe920abc21f26a4e2f3ac7226..3f97896d9384e02b17cb951220077df10b230bcd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -55,24 +55,18 @@ struct t_resinfo {
 #include <gromacs/topology/atoms.h>
 %End
 
-    char          **name {      /* Pointer to the residue name          */
+    SIP_PYOBJECT /* char** */      name /NoSetter/ {      /* Pointer to the residue name          */
     %GetCode
-        sipPy = sipBuildResult(NULL, "s", *(sipCpp->name));
-    %End
-    %SetCode
-
+        sipPy = sipBuildResult(NULL, "A", (sipCpp->name) ? *(sipCpp->name) : NULL);
     %End
     };
     int             nr;         /* Residue number                       */
     unsigned char   ic;         /* Code for insertion of residues       */
     int             chainnum;   /* Iincremented at TER or new chain id  */
     char            chainid;    /* Chain identifier written/read to pdb */
-    char          **rtp {       /* rtp building block name (optional)   */
+    SIP_PYOBJECT /* char** */      rtp /NoSetter/ {       /* rtp building block name (optional)   */
     %GetCode
-        sipPy = sipBuildResult(NULL, "s", *(sipCpp->rtp));
-    %End
-    %SetCode
-
+        sipPy = sipBuildResult(NULL, "A", (sipCpp->rtp) ? *(sipCpp->rtp) : NULL);
     %End
     };
 };
@@ -90,12 +84,9 @@ struct t_pdbinfo {
     double   occup;             /* Occupancy                            */
     double   bfac;              /* B-factor                             */
     bool bAnisotropic;          /* (an)isotropic switch                 */
-    int     *uij {
+    SIP_PYOBJECT /* int * */ uij /NoSetter/ {
     %GetCode
         sipPy = sipConvertToArray(sipCpp->uij, "i", 6, SIP_READ_ONLY);
-    %End
-    %SetCode
-
     %End
     };
 };
@@ -107,16 +98,14 @@ struct t_grps {
 %End
 
     int   nr;                   /* Number of different groups           */
-    int  *nm_ind {
+    SIP_PYOBJECT /* int* */ nm_ind /NoSetter/ {
     %GetCode
         sipPy = sipConvertToArray(sipCpp->nm_ind, "i", sipCpp->nr, SIP_READ_ONLY);
-    %End
-    %SetCode
-
     %End
     };
 };
 
+
 struct t_atoms {
 
 %TypeHeaderCode
@@ -126,38 +115,40 @@ struct t_atoms {
 %End
 
     int            nr;          /* Nr of atoms                          */
-    t_atom        *atom {
+    t_atom        *atom /NoSetter/ {
     %GetCode
         sipPy = sipConvertToTypedArray(sipCpp->atom, sipType_t_atom, NULL, sizeof(t_atom), sipCpp->nr, SIP_READ_ONLY);
     %End
-    %SetCode
-
+    };
+    PStringListWrapper atomname /NoSetter/ {
+    %GetCode
+        PStringListWrapper *wrapper = new PStringListWrapper(sipCpp->atomname, sipCpp->nr);
+        sipPy = sipConvertFromType(wrapper, sipType_PStringListWrapper, Py_None);
     %End
     };
-                                /*[> The following entries will not       <]
-                                [> always be used (nres==0)             <]
-    char          ***atomname;  [> Array of pointers to atom name       <]
-                                [> use: (*(atomname[i]))                <]
-    char          ***atomtype;  [> Array of pointers to atom types      <]
-                                [> use: (*(atomtype[i]))                <]
-    char          ***atomtypeB; [> Array of pointers to B atom types    <]
-                                [> use: (*(atomtypeB[i]))               <]*/
-    int              nres;
-    t_resinfo       *resinfo {
+    PStringListWrapper atomtype /NoSetter/ {
     %GetCode
-        sipPy = sipConvertToTypedArray(sipCpp->resinfo, sipType_t_resinfo, NULL, sizeof(t_resinfo), sipCpp->nres, SIP_READ_ONLY);
+        PStringListWrapper *wrapper = new PStringListWrapper(sipCpp->atomtype, sipCpp->nr);
+        sipPy = sipConvertFromType(wrapper, sipType_PStringListWrapper, Py_None);
+    %End
+    };
+    PStringListWrapper atomtypeB /NoSetter/ {
+    %GetCode
+        PStringListWrapper *wrapper = new PStringListWrapper(sipCpp->atomname, sipCpp->nr);
+        sipPy = sipConvertFromType(wrapper, sipType_PStringListWrapper, Py_None);
     %End
-    %SetCode
+    };
 
+    int              nres;
+    t_resinfo       *resinfo /NoSetter/ {
+    %GetCode
+        sipPy = sipConvertToTypedArray(sipCpp->resinfo, sipType_t_resinfo, NULL, sizeof(t_resinfo), sipCpp->nres, SIP_READ_ONLY);
     %End
     };
     // FIXME: how many pdbinfo's are there?
-    t_pdbinfo       *pdbinfo {
+    t_pdbinfo       *pdbinfo /NoSetter/ {
     %GetCode
         sipPy = sipConvertToTypedArray(sipCpp->pdbinfo, sipType_t_pdbinfo, NULL, sizeof(t_pdbinfo), sipCpp->nres, SIP_READ_ONLY);
-    %End
-    %SetCode
-
     %End
     };
 };